Repository navigation
[BUGFIX] Keep the initial value when a content element is moved - #160
Merged
Merged
Conversation
connectedCallback took value and valueInitial from the attributes on every connect. value is reflected, so after an edit the attribute holds the edited value. Moving a content element with drag and drop reconnects the editable texts inside, and valueInitial pointed to the edited value afterwards: the reset button set the edited value again, and the field stayed changed. value and valueInitial are taken from the attributes on the first connect only.
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
Follow-up to #158.
connectedCallback()ofve-editable-texttookvalueandvalueInitialfrom the attributes on every connect.valueis reflected (reflect: true), so after an edit the attribute holds the edited value. Moving a content element with drag and drop (flipInsertBefore→insertBefore) disconnects and reconnects the editable texts inside, andvalueInitialpointed to the edited value afterwards. The reset button then set the edited value again, and the field stayed changed.Implemented behavior
valueandvalueInitialare taken from the attributes on the first connect only (!this.hasUpdated). Later connects keep both.Tests
ve-editable-text.test.js(browser):npm run test: 94 passing,npm run lint