Show a single sync option for the initial sync. #2858
Merged
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.
Description of the Change
If a user skips setup when they visit the Sync page they are presented the usual Sync and Delete & Sync options. Th problem is that a Delete & Sync is required for the first sync, so if the user just presses Sync errors will occur.
This PR changes the Sync page so that only the correct syncing option is displayed when a sync hasn't been performed yet.
For implementation this PR:
put_mapping
for any Sync requests from the Sync page if there has not been a previous Sync.Closes #2695
Alternate Designs
I've opted for changing the behaviour and wording of the top Sync option for the first sync, rather than just displaying the "Delete & Sync" option. This is because I though it could be confusing if the user was asked to "Delete & Sync" when there was nothing to delete.
For the wording of the panel I drew on the wording of the Getting Started page of the website, and the documentation, but this could be anything.
Possible Drawbacks
I'm not aware of any.
Verification Process
After entering the hosting details during install choose to Skip Setup to bypass the initial sync._ Then manually navigate to ElasticPress > Sync. Instead of seeing both Sync and Delete & Sync panels, only a single panel should be displayed.
Similarly, when choosing to Sync during setup, this is the only panel that should appear during that sync.
Checklist:
Changelog Entry
Fixed - An issue where syncing after skipping setup, instead of deleting and syncing, resulted in an error.
Credits
Props @JakePT