Fix: access query exposed values directly in RunJS context#16357
Merged
Conversation
…eries.queryName` instead of getter functions like `getData`
johnsoncherian
approved these changes
May 11, 2026
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.
📝 What this does
Fixes a bug where
queries.queryName.data(and other properties likeerror,request,response,metadata) returned stale snapshot values when accessed afterawait queries.queryName.run()inside a RunJS query. Properties now read live from the store, so the result of the completed run is always reflected.🔀 Changes
Object.definePropertygetters for all state fields (data,rawData,isLoading,error,request,response,metadata,responseHeaders)getResolvedStatetraversalmetadata,request,response,responseHeaders,errorfields toundefinedin initial query state across all setResolvedQuery call sites, ensuring live getters are registered for these fields from the startdeepCloneof all query state (was immediately overwritten in the loop)run,reset,getData,getRawData,getloadingState) from being overwritten by live descriptors🧪 How to test
restapi1) and a RunJS queryawait queries.restapi1.run(); return queries.restapi1.data— verify it returns the fresh response data, not[]queries.restapi1.errorafter a failed run — verify it reflects the actual errorqueries.restapi1.requestandqueries.restapi1.response— verify they reflect the completed run's metadatareturn queries.restapi1(returning the whole object) still works and is serialisablegetData(),getRawData(),getloadingState()helper methods still work