Store account data in the same way as room data #377
Merged
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.
Previously, we treated the
MatrixEvents
that were inthis.accountData
inMatrixInMemoryStore
as the ground truth and saved those to disk and restoredthem back upon load. This did not consider that there are no emitted events
when they are restored. Riot-Web was listening for a specific account data
event in order to dynamically update the theme. When the page was reloaded, we
dutifully put the right event in
MatrixInMemoryStore
, but failed to emit anevent to tell Riot-Web this. This led to element-hq/element-web#3247
This patch fixes it by treating the
/sync
response as the ground truth andignoring
this.accountData
entirely. This means that upon load, we will beinjecting an
account_data
key into the initial/sync
response. This willcause it to be added to
this.accountData
in the store AND cause the event tobe emitted.
Manually tested and it does indeed fix it.