Skip to content

Recreate disposed machines after Activity resumes - #3885

Open
wanxiankai wants to merge 1 commit into
tailwindlabs:mainfrom
wanxiankai:fix/listbox-activity-resume
Open

Recreate disposed machines after Activity resumes#3885
wanxiankai wants to merge 1 commit into
tailwindlabs:mainfrom
wanxiankai:fix/listbox-activity-resume

Conversation

@wanxiankai

Copy link
Copy Markdown

Fixes #3880.

When React Activity hides a subtree, the machine cleanup disposes its subscriptions while React preserves the component's hook state. On reveal, the previous memoized machine was reused without its constructor-installed handlers, leaving Listbox option selection and outside-click behavior inactive.

Changes

  • track whether a component machine has been disposed
  • add a shared useMachine hook that rebuilds disposed instances while retaining normal render stability
  • use the lifecycle-aware hook for Listbox, Combobox, Menu, and Popover machines
  • add a regression test for recreating a disposed Listbox machine with fresh subscriptions

Test plan

  • focused Listbox machine recreation test
  • npm run lint-check
  • React package TypeScript check with tsc --noEmit
  • React package esbuild bundle

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@wanxiankai is attempting to deploy a commit to the Tailwind Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

Listbox becomes non-interactive after soft navigation when Next.js cacheComponents is enabled

1 participant