Repository navigation
fix(core): load the entry in the address when the editor moves to another one - #8110
Merged
Merged
Conversation
…ther one The router keeps the editor mounted when the address moves from one entry to another, for example after editing the URL or going back in the browser, and the editor loaded its entry only on mount. The draft kept the previous entry, so the editor showed its path, title and body under the new address, and saving would have written them there. The editor now loads the entry in the address when the draft holds a different one. Its own redirects, after saving a new entry or after a save or publish that changes the slug, load the entry they lead to first, so the draft already matches and they are left as they were.
✅ Deploy Preview for decap-cms ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Summary
The editor loaded its entry only when it mounted. The router keeps it mounted when the address moves from one entry to another (an edited URL, the browser's back and forward buttons, a link pasted into an open admin tab), so the draft kept the previous entry. The editor then showed the previous entry's path, title and body under the new address, and a save would have written them there. Found while testing 3.19.0 on the tester: going from
sink/entries/exampletopages/entries/about/indexshowed the kitchen sink's data in the Pages editor.The editor now loads the entry in the address when the draft holds a different one. It does what unmounting and mounting again would: it stops the previous entry's notes polling, flushes its pending backup, discards the draft, then retrieves the new entry's backup and loads it.
Its own redirects are left as they were: after saving a new entry, or after a save or publish that changes the slug, the editor loads the entry it is going to before it navigates, so the draft already matches the address.
Test plan
main.main