-
Notifications
You must be signed in to change notification settings - Fork 2k
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
CPT: Display notice when permanent deletion succeeds or fails #6536
Conversation
Do we need a link to the post in case of failure? Thinking if you delete three posts, navigate away on a slow connection, and and you get a single error, it would be hard to know which one failed. |
Perhaps |
@mtias It's like you're fully aware of the holes in adding actions via the notices reducer 😄 Namely in this case the fact that we don't have access to the post object in the delete dispatching. The only ways I could imagine achieving adding a title and link to the notice would be either:
|
Can't you use the |
No, the state passed to the reducer is its local state, not the global state (which some claim is a good thing). |
Fun, something seems to be amiss in the design of this then, either at the post actions level or the notices dispatching. |
Looks like these notices are set to not I think another option for handling this would be to potentially add the failed deleted post back to the post list. Or do not remove it from the list optimistically. I believe we chatted about that idea before Andrew but wasn't sure if that was possible. Code looks/works good for me in testing. |
re:
Yes, if something failed the statuses should be reconciled and the posts re-appear. Though I wouldn't change how we optimistically delete it, because that's exactly how we want it to behave in offline mode, for instance. In any way, we need to assume that the user may be looking at any page when the app learns an action failed, and we need to notify them. |
Closing in favor of #6645 |
Related: #6306
This pull request seeks to cause a notice to be displayed after a request to permanently delete a post has completed, reflecting the success or failure of that request.
Testing instructions:
Verify that a notice is shown after a post permanent delete request finishes. You can force a delete failure by toggling the "Offline" throttle option in Chrome Developer Tools Network tab.
Test live: https://calypso.live/?branch=add/cpt-delete-post-notice