Skip to content

Commit 3c863dd

Browse files
committed
fix: copilot reviews
1 parent df9b471 commit 3c863dd

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

packages/gqty/src/Accessor/resolve.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export const createUnionAccessor = ({
214214
* Key fix for React 19 dev mode: For data-backed proxies, `ownKeys()` only
215215
* returns keys that exist in the cache, not all schema fields. This prevents
216216
* React's prop diffing from triggering selections for fields the user never
217-
* requested. The `allowEnumeration` context flag overrides this behavior for
217+
* requested. The `activeEnumerators` context flag overrides this behavior for
218218
* helpers like selectFields() that need to enumerate all schema fields.
219219
*/
220220
const createObjectProxyHandler = (
@@ -223,7 +223,7 @@ const createObjectProxyHandler = (
223223
): ProxyHandler<GeneratedSchemaObject> => {
224224
return {
225225
ownKeys(target) {
226-
// When allowEnumeration > 0 (e.g., selectFields helper), always
226+
// When activeEnumerators > 0 (e.g., selectFields helper), always
227227
// return all schema keys regardless of cache state.
228228
if (context.activeEnumerators > 0) {
229229
return Reflect.ownKeys(target).filter(
@@ -403,7 +403,7 @@ export const createObjectAccessor = <TSchemaType extends GeneratedSchemaObject>(
403403
if (!type) throw new GQtyError(`Invalid schema type ${__type}.`);
404404

405405
// Create a per-proxy handler
406-
// Pass context for allowEnumeration flag access
406+
// Pass context for activeEnumerators flag access
407407
const handler = createObjectProxyHandler(
408408
isCacheObject(data) ? data : undefined,
409409
context

packages/gqty/src/Client/context.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,11 @@ export const createContext = ({
106106
selectSubscriptions.forEach((fn) => fn(selection, cacheNode));
107107
},
108108
reset() {
109-
this.shouldFetch = false;
109+
this.activeEnumerators = 0;
110110
this.hasCacheHit = false;
111111
this.hasCacheMiss = false;
112-
this.shouldFetch = false;
113-
this.activeEnumerators = 0;
114112
this.notifyCacheUpdate = cachePolicy !== 'default';
113+
this.shouldFetch = false;
115114
},
116115
subscribeSelect(callback) {
117116
selectSubscriptions.add(callback);

0 commit comments

Comments
 (0)