Drop the unread assetStatuses field from AssetContext and document the provider contract - #3957
Draft
jeremywiebe wants to merge 7 commits into
Draft
Drop the unread assetStatuses field from AssetContext and document the provider contract#3957jeremywiebe wants to merge 7 commits into
jeremywiebe wants to merge 7 commits into
Conversation
Contributor
npm SnapshotWant to try this PR's changes before it merges? Comment |
Contributor
|
Size Change: -29 B (-0.01%) Total Size: 518 kB 📦 View Changed
ℹ️ View Unchanged
|
jeremywiebe
commented
Jul 27, 2026
|
|
||
| const context: React.Context<Context> = React.createContext(defaultContext); | ||
| /** | ||
| * An internal React context for keeping track of whether a component is fully |
Collaborator
Author
There was a problem hiding this comment.
This is a pretty long comment, but it describes the full contract that was implied previously.
I think we should see if we can move most (all) of the book-keeping into this context, but I want to do that in a separate PR.
jeremywiebe
commented
Jul 30, 2026
| const AssetContext: React.Context<AssetContextValue> = | ||
| React.createContext(defaultAssetContext); | ||
|
|
||
| export default context; |
Collaborator
Author
There was a problem hiding this comment.
Naming the object locally differently than what most imports name it causes confusion.
jeremywiebe
force-pushed
the
jer/zoomable-asset-context
branch
2 times, most recently
from
August 12, 2026 23:27
a8a3482 to
5e3d787
Compare
…AssetContext and document the provider contract
jeremywiebe
force-pushed
the
jer/asset-context-cleanup
branch
from
August 12, 2026 23:48
a6dd669 to
e9ebb6c
Compare
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.
Summary:
AssetContextcarried anassetStatusesdictionary alongsidesetAssetStatus, and nothing ever read it (even in the original implementation). Every consumer in the codebase takes onlysetAssetStatus; the context isn't exported from the package, so there are no external readers either. Worse, publishing the record invited providers to keep statuses in React state — exactly the mistake that made the mechanism silently inert (fixed earlier in this stack).The context is now report-only, and the bookkeeping contract that a provider has to implement is documented on it:
The known gaps are documented there too — no way to unregister, and assets that register on a later pass.
No behaviour change. Also includes some renaming and rearranging in the same file for readability.
Both providers still hand-roll the same bookkeeping, with two different implementations of "settled". A follow-up will centralize that into a shared tracker owned by
asset-contextitself.A future PR may re-work this so that the book-keeping is inside the
AssetContext, where it should arguably be!Issue: LEMS-4419
Test plan:
pnpm testpnpm typecheck