fix(bindx): drop vestigial handle dispose lifecycle that broke late writes#55
Merged
Merged
Conversation
…rites Handles are stateless live views over the store: the only subscriptions they create are returned from subscribe() and owned by useSyncExternalStore, not stored on the handle. So dispose() freed nothing — it only set _disposed and armed assertNotDisposed() to throw on legitimate late writes through an accessor a consumer still holds (e.g. the Slate block editor dispatching setValue from an async onChange after the entity version bumped and EntityHandleRenderer recreated the handle). The dispose machinery was orphaned by the migration away from the eager identityMap subscription model, where handles really did hold _unsubscribe. Remove the dispose lifecycle from handles (dispose/isDisposed/assertNotDisposed in BaseHandle, the dispose() overrides, 25 assertNotDisposed() call sites, and dispose() from the internal RelationHandleRaw interface), delete the now-dead core/Disposable.ts, and stop disposing superseded handles in useEntity and <Entity>. reset() stays — it is a real operation. Add a regression test covering a captured field accessor that stays writable across a data-driven re-render. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EAKx7JbV7Z7EVXofqRgwop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Handles are stateless live views over the store: the only subscriptions they create are returned from
subscribe()and owned byuseSyncExternalStore, not stored on the handle. Sodispose()freed nothing — it only set_disposedand armedassertNotDisposed()to throw on legitimate late writes through an accessor a consumer still holds (e.g. the Slate block editor dispatchingsetValuefrom an asynconChangeafter the entity version bumped andEntityHandleRendererrecreated the handle).The dispose machinery was orphaned by the migration away from the eager
identityMapsubscription model, where handles really did hold_unsubscribe.Change
dispose/isDisposed/assertNotDisposedinBaseHandle, thedispose()overrides, allassertNotDisposed()call sites, anddispose()from the internalRelationHandleRawinterface.core/Disposable.ts.useEntityand<Entity>.reset()stays — it is a real operation.Tests
Adds a regression test covering a captured field accessor that stays writable across a data-driven re-render.
🤖 Generated with Claude Code