Refactor configuration counting and query key structure - #48
Merged
AlexKempen merged 7 commits intoAug 30, 2026
Conversation
Every library-scoped query is now ["library", libraryId, <endpoint>, ...], so useRefreshLibrary invalidates that one prefix instead of enumerating each query's match key. Drops the *QueryMatchKey helpers (two of which were already unused) and renames the library snapshot key to libraryDataQueryKey, freeing libraryQueryKey to name the prefix. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DN1YyJcDC5UGqCoNhfUuNy
Opening a group replaced the whole page with a bare zero state until the library snapshot landed, leaving no name and no way back, and reused the home page's plural "Loading groups..." copy. The header now renders without a group, showing a skeleton for the name and dropping the menu until there is something to act on, so the loading and error states sit inside the page instead of standing in for it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DN1YyJcDC5UGqCoNhfUuNy
The spinner the header work was meant to restore was already showing; only its wording was wrong, carried over from the home page's list. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DN1YyJcDC5UGqCoNhfUuNy
The worker stands the element default in for a configuration it has yet to render, so changing configuration dropped the preview the user had back to the default before the new render landed. The preview now keeps the last real render until the one it asked for arrives; only an element with nothing rendered yet shows the default. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DN1YyJcDC5UGqCoNhfUuNy
Assemblies pull metadata from the assembly tab, so the configuration cap never applies to them; the indexing row now says so instead of reporting an error an admin cannot act on. Configurations report their real total. countConfigurations stops at the index cap because the load path enumerates every combination, so counting for display gets its own depth-first pass that holds one path at a time. The per-parameter Indexed/Not indexed badge becomes an icon shown only where Onshape excludes a parameter from affecting properties, which is the lever on the count — quantity parameters no longer read as a state an admin can change. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DN1YyJcDC5UGqCoNhfUuNy
Onshape's own entry needs a session and https, so there was no written way to run the app locally; standalone mode is, and it wants three vars rather than the README's OAuth setup. Those vars reached the test Worker as well, where FORCE_SIGNED_IN rewrote what the auth tests assert, so the pool no longer loads .env. Also trims comments added over this branch to the length AGENTS.md asks for, and drops ones the signature already gave. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DN1YyJcDC5UGqCoNhfUuNy
ACCESS_LEVEL_OVERRIDE granted the level and VITE_DEFAULT_ACCESS_LEVEL picked the one viewed, so both had to be set to the same thing to get a usable dev session. Wrangler puts .env on the Worker's env as well as Vite's, so one VITE_-prefixed entry reaches both sides. The override also outranked a real Onshape session anywhere it was set, despite the README saying it did nothing in production. It is now gated the way FORCE_SIGNED_IN already was, with a test that fails without it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DN1YyJcDC5UGqCoNhfUuNy
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
This PR refactors configuration counting logic to distinguish between indexed configurations (capped at
MAX_PART_NUMBER_CONFIGURATIONS) and total combinations (capped atMAX_COUNTED_CONFIGURATIONS), and restructures query keys to use a hierarchical library-scoped prefix for better cache invalidation.Key Changes
Configuration Counting
countCombinations()function that counts all parameter combinations without the indexing cap, allowing admins to see the true configuration count even when it exceeds the indexing limitMAX_COUNTED_CONFIGURATIONSconstant (100,000) as a separate cap for display purposesInsertableParsedSectionto use the newuseDisplayedConfigurationCount()hook instead of receiving count as a propBuild Status UI
IndexedBadgecomponent withExcludedFromPropertiesIconthat shows a file icon only for cosmetic parametersIndexingRowto indicate metadata is pulled directly from the assembly tabElementTypeto support assembly detectionQuery Key Structure
libraryQueryKey(libraryId)libraryQueryKey()tolibraryDataQueryKey()for claritylibraryQueryMatchKey(),libraryVersionQueryMatchKey(), etc.) in favor of prefix-based invalidationuseRefreshLibrary()to invalidate the entire library prefix, simplifying cache managementThumbnail Preview
useLastRenderedUrl()hook to persist the last successfully rendered image URL across configuration changesTesting
countCombinations()including edge cases, visibility conditions, and cap behaviorcountCombinations()agrees withcountConfigurations()under the index capDocumentation
https://claude.ai/code/session_01DN1YyJcDC5UGqCoNhfUuNy