Integrate dirty
state, API requests, and publish button
#700
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.
This simple PR integrates post saving/updating introduced in #594 and dirty state introduced in #610.
Make
SavedState
aware of API requestsTo test: Edit a post until it shows "Unsaved changes" in the top left. Save it via the Update/Save draft button and observe that the text changes from "Unsaved changes" to "Saved".
Make
PublishButton
aware ofdirty
stateTo test: Save a post using the Update/Save draft button. The button will show "Updated!" or "Saved!".
Edit a post until it shows "Unsaved changes" in the top left. Verify that the button text changes back to "Update" or "Save".
Next steps
In short: error handling. Currently errors are indicated by the
PublishButton
showing "Update failed" or "Save failed". In this PR, the error state is cleared when the post is modified again. However, really we probably want a red error icon/message next to the publish button instead, and this would stick around after the post is edited. This should be a separate task that builds on @jasmussen's mockups from #594 (comment).