Skip to content

Keep destroy() from tearing down another active tour - #621

Open
MaciejZet wants to merge 3 commits into
nilbuild:masterfrom
MaciejZet:fix/destroy-stale-instance
Open

MaciejZet wants to merge 3 commits into
nilbuild:masterfrom
MaciejZet:fix/destroy-stale-instance

Conversation

@MaciejZet

@MaciejZet MaciejZet commented Sep 29, 2026 •

Copy link
Copy Markdown

Summary

Fixes #504. destroy() on one instance was removing the shared overlay, body classes, and highlighted state for a newer tour. A delayed destroy() from an old highlight could therefore close the tour that had replaced it.

This patch keeps ownership of the page-level tour explicit. A stale instance releases only its own listeners and highlight; the current instance keeps its popover, overlay, body classes, and active highlight. An instance that never started, or was already destroyed, returns without touching the document. The same instance can start another highlight after a real teardown.

This PR stays focused on the stale-instance destroy() invariant. setSteps() behavior is unchanged.

Test plan

  • pnpm --dir packages/driver test:run (341 tests)
  • pnpm build
  • Second destroy() after teardown leaves the replacement tour up
  • destroy() while the old instance still reports isActive() leaves the replacement tour up
  • destroy() on an instance that never started leaves the live tour up
  • The same instance can highlight again after destroy()
  • An animated highlight destroyed across frames does not catch the next tour

Refs #504

A second destroy, or destroy on an instance that no longer owns the
overlay, only releases that instance. The tour on the page keeps its
popover, highlight, and body class.

Fixes nilbuild#504

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling destroy() on an already destroyed driver object destroys another driver object that is in active state.

1 participant