Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store account data in the same way as room data #377

Merged
merged 2 commits into from
Feb 21, 2017

Conversation

kegsay
Copy link
Member

@kegsay kegsay commented Feb 21, 2017

Previously, we treated the MatrixEvents that were in this.accountData in
MatrixInMemoryStore as the ground truth and saved those to disk and restored
them 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 an
event 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 and
ignoring this.accountData entirely. This means that upon load, we will be
injecting an account_data key into the initial /sync response. This will
cause it to be added to this.accountData in the store AND cause the event to
be emitted.

Manually tested and it does indeed fix it.

Previously, we treated the `MatrixEvents` that were in `this.accountData` in
`MatrixInMemoryStore` as the ground truth and saved those to disk and restored
them 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 an
event 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 and
ignoring `this.accountData` entirely. This means that upon load, we will be
injecting an `account_data` key into the initial `/sync` response. This will
cause it to be added to `this.accountData` in the store AND cause the event to
be emitted.
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ew, but okay

@dbkr dbkr merged commit 2b96cd7 into develop Feb 21, 2017
@t3chguy t3chguy deleted the kegan/indexeddb-account-data branch May 10, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants