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.
Generic asynchronous state. TBD.
Today we have a limbo in the flow of opening an view that is at the moment BEFORE opening and AFTER opening, where the information between those steps goes. People often come to me with questions about how to deal with asynchronous data due to the nature of the Inventory Framework views. Async state come to help.
Without an async state we needed to write a UserProfileView that loads a UserProfile from the database we...
initialStatethat holds aUserProfiletypeThis makes the view dependent on the value coming from wherever, given that the view can be opened in multiple ways and makes it incompatible with the idea of creating Flows with inventories, so, if we use for example a
context.back()orcontext.openForPlayer(UserProfileView.class)from another view, we would need to somehow obtain this value (UserProfile) that is being pulled from the database asynchronously and assign it as a parameter of the view but... the problem here is that this view that is calling the UserProfileView view is not asynchronous and it does not have the capacity to process this information.Now with asynchronous state we...
initialAsyncStatethat holds aUserProfiletype that expects aCompletableFuture<UserProfile>parameterError handling can also be done in the view itself, showing a item for example!
I will rewrite State Management on Wiki entirely before merging this PR.