fix(useTourEngine): start tour when run is true and steps load after mount - #1212
Open
ArmaanjeetSandhu wants to merge 1 commit into
Open
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
There was a problem hiding this comment.
Pull request overview
Fixes a regression in useTourEngine where tours wouldn’t start if run is true from the initial render but steps are populated asynchronously after mount (issue #1211). The updated update-effect now mirrors the mount behavior by starting the tour when run && size && status === IDLE and the provided steps validate.
Changes:
- Update
useTourEngine’suseUpdateEffectto callcontrols.start(...)(instead of only transitioning toREADY) when valid steps arrive after mount whilerunis alreadytrue. - Expand the
useUpdateEffectdependency list to include the referenced props/values used inside the effect. - Add a regression test covering “run already true + steps arrive after mount” and asserting the tour enters
RUNNINGand emitsTOUR_START.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/hooks/useTourEngine.ts | Starts the tour (not just sets READY) when valid steps arrive after mount and run is already true. |
| test/hooks/useTourEngine.spec.ts | Adds a regression test reproducing #1211 and asserting the tour starts when async steps arrive. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Addresses #1211
The fix matches the mount effect, i.e., when
run && size && status === idle, start the tour if the steps validate.elsebranch keeps the prioridle → readybehavior for invalid steps, so the only behavioral change is that valid steps now start.status === IDLEguard makes any extra fire a no-op, so there's no re-render churn and no double-start withusePropSync(both the "run already true" and "run toggled" paths start exactly once).One new regression test for this has been added in
test/hooks/useTourEngine.spec.ts. The full suite passes, and there are no API changes.