Repository navigation
fix(mosaic): resume machine actors after stop instead of resetting them - #10477
Conversation
Ports the machine fix from #10341 without its React 19.2 test project, and makes a few tests independent of render and effect counts.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 2de79e4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-biometrics
@clerk/expo-google-signin
@clerk/expo-native-components
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/mosaic
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Description
Brings over the machine fix from #10341, without its React 19.2 Vitest project.
Machine actors now resume after
stop()/start()instead of resetting to the initial state:start()afterstop()resumes in the current state. Entry actions and invokes are not run again. The firststart()is unchanged.aftertimers are paused on stop and re-armed on start.snapshotkeeps it across a restart. Before, StrictMode's stop/start sentuseMachine(machine, { snapshot })back to the initial state.useMachinefiresonDoneonce per actor. Before, a machine that starts in a final state called it twice under StrictMode.useMachinesubscribes withuseSyncExternalStorebefore its start effect, so a flow shown again inside React 19.2<Activity>renders the resumed snapshot. This one is not covered by a test here, since the repo runs React 18.3.Also makes a few tests independent of how many times React renders or runs effects:
use-transition: therequestAnimationFramemock keys callbacks by a stable id, so cancelling a frame from an earlier batch no longer leaves a hole in the queue.use-layout-animation: asserts one live animator while mounted and every animator disposed once, instead of countingdisposecalls.useSelectorrender tests: assert no re-render after an unrelated change and a re-render after a related one, instead of exact render counts.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change