@@ -548,20 +548,25 @@ export const createUseQuery = <TSchema extends BaseGeneratedSchema>(
548548 : query ;
549549
550550 return new Proxy ( target , {
551- // Only expose $refetch and $state in enumeration.
551+ // Only expose $refetch and $state in enumeration in dev mode .
552552 // This prevents React 19 dev mode from enumerating all schema fields
553553 // during prop diffing, which would trigger unintended selections.
554- // Users who need to enumerate query fields should access the underlying
555- // accessor directly or use selectFields/getFields helpers.
556- ownKeys : ( ) => [ '$refetch' , '$state' ] ,
557-
558- getOwnPropertyDescriptor : ( target , key ) => {
559- if ( key === '$refetch' || key === '$state' ) {
560- return Reflect . getOwnPropertyDescriptor ( target , key ) ;
561- }
562- // Return undefined for schema keys - they're not "own" properties
563- return undefined ;
564- } ,
554+ // In production, return actual target keys (just $refetch and $state).
555+ ownKeys :
556+ process . env . NODE_ENV !== 'production'
557+ ? ( ) => [ '$refetch' , '$state' ]
558+ : undefined ,
559+
560+ getOwnPropertyDescriptor :
561+ process . env . NODE_ENV !== 'production'
562+ ? ( target , key ) => {
563+ if ( key === '$refetch' || key === '$state' ) {
564+ return Reflect . getOwnPropertyDescriptor ( target , key ) ;
565+ }
566+ // Return undefined for schema keys - they're not "own" properties
567+ return undefined ;
568+ }
569+ : undefined ,
565570
566571 has : ( _ , key ) => {
567572 // $refetch and $state are always present
0 commit comments