Navigation Menu

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 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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants