Conversation
Non-observable (QueryFor) proxies lacked a queryName field. Observable proxies already emitted one via ObservableQuery.hbs. Adding it to Query.hbs and to the QueryFor base class ensures every generated proxy carries a stable, fully-qualified name string that the React hooks can use as a cache key instead of constructor.name, which minifiers mangle to single letters. The TestApp shared proxies are regenerated to pick up the new field.
Under minification every class name becomes a single letter, so constructor.name is not a stable cache key. Two different query types with the same minified name would share one cache entry, receiving each other's subscription data and causing incorrect renders. Both useObservableQuery and useQuery now instantiate the query first to read queryName (a hardcoded fully-qualified string in every generated proxy) and use that as the QueryInstanceCache key. constructor.name is kept as a fallback for hand-written, non-generated queries. Also fixes a false-positive console.error: the NON-ARRAY data guard now checks queryInstance.enumerable before logging, so single-item observable queries no longer produce a spurious error on every push.
Both useObservableQuery and useQuery specs use Object.defineProperty to
force two distinct query classes to share the same constructor.name ('a'),
reproducing what a minifier does in production. The specs verify that
each query still receives its own subscription and data, not the other's.
…in ArcCore TestApp
resolve.dedupe forces Vite to resolve @cratis/fundamentals to a single copy from
the project root. Without this the Arc source node_modules (v7.7.3) and the
workspace root (v7.8.2) each produced a distinct Guid class, causing
JsonSerializer's typeConverters Map.has() lookup to always miss. The result was
Guid values serialised as { bytes: [...], _stringVersion: "..." } instead of a
plain string, producing HTTP 500s when posting commands with Guid properties.
Also adds vite.config.minified.ts and build:minified / serve:minified scripts so
the minification scenario (keepNames: false, full identifier mangling) can be
built and served against the real backend with a single command.
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.
Fixed
QueryInstanceCachewhen a minifier mangles all class names to single letters — hooks now use the proxy-generatedqueryName(a hardcoded fully-qualified string) as the cache key instead ofconstructor.name.readonly queryNamein the same way observable proxies already did;QueryForbase class declares the optional property.Guidcommand properties no longer serialize as{"bytes":[...],"_stringVersion":"..."}when the ArcCore TestApp is built with Vite —resolve.dedupefor@cratis/fundamentalsprevents two distinct class instances (v7.7.3 in Arc source node_modules, v7.8.2 at workspace root) from causingJsonSerializer'stypeConvertersmap lookup to miss.[useObservableQuery] NON-ARRAY data receivedconsole error no longer fires on every SSE push for single-item (non-enumerable) observable queries.Added
yarn build:minifiedandyarn serve:minifiedscripts in the ArcCore TestApp to build with full identifier minification (keepNames: false) and serve against the real backend, making it straightforward to test Arc under minification conditions.