Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Store component state for editors #1746

Merged
merged 1 commit into from
Feb 14, 2018
Merged

Conversation

lukebarnard1
Copy link
Contributor

to prevent a forceUpdate from /sync causing the editors to revert
before the user had a chance to hit "Save".

Part of fixing element-hq/element-web#6019

to prevent a forceUpdate from /sync causing the editors to revert
before the user had a chance to hit "Save".

Part of fixing element-hq/element-web#6019
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.

Sorry, I'm failing to understand what the cause of the bug was or how this fixes it. It looks like this is sort of making the component controlled, except not because EditableText doesn't support that and it's instead updating the initialValue prop on each keypress but I don't understand how this helps.

@dbkr dbkr assigned lukebarnard1 and unassigned dbkr Feb 13, 2018
@lukebarnard1
Copy link
Contributor Author

lukebarnard1 commented Feb 14, 2018

By storing the values as state on the react component, we persist the changes that have happened so far and by controlling EditableText, we prevent it from reverting to initialValue.

Do you think we should re-implement EditableText to be controlled, storing it's own react state?

@dbkr
Copy link
Member

dbkr commented Feb 14, 2018

After brief clarification in #riot-dev:matrix.org, it still reverts to initialvalue, but that's now OK because initialValue has been updated whatever the user typed in.

So yeah, this looks fine.

@dbkr dbkr merged commit 46b8fb9 into develop Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants