-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Core Data: Support server side save filters. #17532
Core Data: Support server side save filters. #17532
Conversation
918a99b
to
8c51661
Compare
Unrelated, but it would be good to clear the "saving error notice" if the next save is successful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works well
ecf3b84
to
aa967a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Thanks for the fixes Enrique
This is probably something that could use an e2e test but not a blocker for this PR. We can work on it later if needed.
I thought it would happen automatically, because they use the same notice ID, is this not expected of the notices package?
Yeah. |
It would but there's no success notices for draft saves :) |
Should I add an explicit |
We could add a remove on successful saves (but probably something in the editor store instead, I'm also fine for it being a separate PR) |
Sounds good. |
e339b52
to
7476ed3
Compare
FYI - this fixes an issue we were having with full site editing - Automattic/wp-calypso#36015 - the FSE posts currently have the header and footer template blocks added and stripped server side, and this was causing the edits/dirty state to be retained following a successful save. I am not able to replicate this issue after applying this patch locally 👍 |
@glendaviesnz That's great. I'll merge this as soon as the CI issues are resolved. |
7476ed3
to
7f8d724
Compare
* Core Data: Support server side save filters. * Core Data: Fix tests. * Core Data: Restore edits and not the save payload on failed saves. * Core Data: Merge in new edits when restoring state after a failure.
* Core Data: Support server side save filters. * Core Data: Fix tests. * Core Data: Restore edits and not the save payload on failed saves. * Core Data: Merge in new edits when restoring state after a failure.
Description
core-data
saving had an issue where edits (and dirtyness) would be kept after saving when the server had filters that modified the data. This happened because the client did not recognize the edits as persisted if the API responded with different values to what was sent.This PR fixes this by considering that the API can change values while saving, and it changes
core-data
so it will not keep the corresponding edits unless they were made after the request was sent.How has this been tested?
This filter was added to test the behavior with a post title filter:
It was then verified that saving
error
keeps everything as is, but saving any other title clears dirty state and sets the current title to whatever you saved with'_filtered!'
concatenated at the end.Types of Changes
New Feature:
core-data
now plays nice with server side save filters.Checklist:
closes #17491