Fix some UI sync issues due to NotifyingList bug#647
Open
Lama-Thematique wants to merge 2 commits intocommetchat:mainfrom
Open
Fix some UI sync issues due to NotifyingList bug#647Lama-Thematique wants to merge 2 commits intocommetchat:mainfrom
Lama-Thematique wants to merge 2 commits intocommetchat:mainfrom
Conversation
Contributor
Author
|
I also presume that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When creating a NotifyingList this code gets run:
In all instance of creating a NotifyingList the params sync is always true.
We use those Streams to send the index of the deleted/add/modified element.
Here is the description of
sync=truefor StreamController in the docs:This cause issue when removing something in from the list:
Because either:
sync=truethe subscribers callback get an unmodified list (the item is still not removed), if we update an UI state in the callback (without async call) the UI does not update.How do we fix this:
We don't send the index but directly the element being modified, as it turns out we never specifically need the index, we always only use the index to lookup the element.
This is what this Pull Request implements.
In practice when i leave a space I now see the update, whereas before this patch we don't have any UI update.
PS
Note that if you want I can try to rework a large portion of the matrix backend (client, clientmanager, rooms, etc) to try to make cleaner, easier to use and lower time complexity (using Sets and Hashmap instead of lists).
Please inform me if you are interested or not so that I don't loose a buch of time on this.
Note It might take a quite some time to rework all that