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.
While testing, I noticed that I would be asked to wait before closing the panel after completing the walkthrough. At first it seemed to be a firefox-specific issue, but really it's just that the data wasn't finished saving. If I click "Stay on page", the spinner stay on-screen, and blocks my way to try closing the panel again.
This PR adds a new function
afterSavingData
, which lets you pass through a callback to be run once all the data is saved - immediately if nothing is waiting, or by checking every half-second.This is used on both the Woo step, and before closing the panel. Otherwise there was the (probably small) possibility of users losing the last steps they've just set.
To test:
sleep( 3 )
to line 27 inclass.jetpack-onboarding-end-points.php
), run through the onboardingYou can also test by not setting up WooCommerce, and instead walking through to the end. Closing the panel should also have you wait for a bit before reloading the page.