Fix useAtomSuspense registry isolation - #6672
Conversation
🦋 Changeset detectedLatest commit: bb46f2f The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesAtom suspense registry isolation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Comment |
Bundle Size Analysis
|
Summary
useAtomSuspensepromises to the activeAtomRegistrysuspendOnWaitingmodeRoot cause
The Suspense promise cache was module-global and keyed only by atom. When two registries rendered the same atom concurrently, the second registry reused the first registry's promise. Its Suspense boundary therefore remained blocked even after its own atom reached a successful result.
Using registry-scoped
WeakMaps keeps the existing atom-level deduplication without coupling independent registries or retaining disposed registries.Validation
pnpm test --run packages/atom/react/test/index.test.tsxpnpm --filter @effect/atom-react checkpnpm --filter @effect/atom-react buildpnpm checkpnpm lintpnpm test-types --target '>=5.9'pnpm circularSummary by CodeRabbit
Bug Fixes
useAtomSuspenseso concurrent atom registries resolve independently.Tests