Adds raiseEvent parameter to getUser() method #1817
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Relates to #712 and provides a solution that is backwards-compatible and will fix an issue for some users.
Adding a new parameter
raiseEvent = false
to theUserManager.getUser()
method to allow execute theaddUserLoaded()
event handlers after raising theuserLoaded
event.Background: The
userLoaded
event does currently not get raised whenever theuser
value is being read from the local storage, which happens whenever no user data has to be fetched from the authority but from the store. In #712 developers complained about this behavior since some business-logic depends on thegetUser()
/userLoaded
method/event for .e.g. loading additional user-related data from third-party sources like APIs. In the case that a user is already authenticated and e.g. reloads the page, the storage provides thegetUser()
data but does not raise theuserLoaded
event anymore. That will break the described business-logic and must be avoided with a workaround, e.g. usingProxy()
which is not preferred as the optimal solution (see #712 (comment) for an implementation example withProxy()
).This solution allows raising the event on purpose whenever the parameter is set to handle further business logic after checking for a users authentication.
Tests
Added unit-tests for the new parameter which is by default set to
false
.