fix: prevent onboarding hints after anchor removal - #236
Conversation
|
One scenario this breaks: the anchor is remounted (not just removed) while Sequence with
Result: the hint never shows for B even though B is in the DOM, and nothing re-triggers it ( Suggestion: check the current anchor instead of the one captured in the closure, e.g. in the promo hook: const currentElement = instance.reachedElements.get(stepData.stepSlug);
if (!result || !currentElement?.isConnected) {and in Would be good to add a test for "anchor replaced with a new one before init resolves → hint shows on the new element". |
Onboarding hints could appear after their anchor was removed while asynchronous checks or promo initialization were still pending, leaving a detached popup and an active promo.
Recheck anchor connectivity before displaying the hint and skip the promo if its anchor disappears during startup. This preserves onboarding progress and allows the hint to appear when the user returns.