@data-client/react@0.15.0-beta-20251006024044-92bd01c4976f2921993b8c9f1e4dbb87af87ba7b
Pre-releaseMinor Changes
-
#3459
997ca20Thanks @ntucker! - BREAKING CHANGE: useDebounce() returns [val, isPending]This was previously exported in
@data-client/react/nextto make migrations easy. This will
still be available there.Before
import { useDebounce } from '@data-client/react'; const debouncedQuery = useDebounce(query, 100);
After
import { useDebounce } from '@data-client/react'; const [debouncedQuery] = useDebounce(query, 100);
Before
import { useDebounce } from '@data-client/react/next'; const [debouncedQuery, isPending] = useDebounce(query, 100);
After
import { useDebounce } from '@data-client/react'; const [debouncedQuery, isPending] = useDebounce(query, 100);
-
#3449
1f491a9Thanks @ntucker! - BREAKING CHANGE: schema.normalize(...args, addEntity, getEntity, checkLoop) -> schema.normalize(...args, delegate)We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument.
/** Helpers during schema.normalize() */ export interface INormalizeDelegate { /** Action meta-data for this normalize call */ readonly meta: { fetchedAt: number; date: number; expiresAt: number }; /** Gets any previously normalized entity from store */ getEntity: GetEntity; /** Updates an entity using merge lifecycles when it has previously been set */ mergeEntity( schema: Mergeable & { indexes?: any }, pk: string, incomingEntity: any, ): void; /** Sets an entity overwriting any previously set values */ setEntity( schema: { key: string; indexes?: any }, pk: string, entity: any, meta?: { fetchedAt: number; date: number; expiresAt: number }, ): void; /** Returns true when we're in a cycle, so we should not continue recursing */ checkLoop(key: string, pk: string, input: object): boolean; }
Before
addEntity(this, processedEntity, id);
After
delegate.mergeEntity(this, id, processedEntity);
-
#3451
4939456Thanks @ntucker! - state.entityMeta -> state.entitiesMeta -
#3449
1f491a9Thanks @ntucker! - BREAKING CHANGE: schema.queryKey(args, queryKey, getEntity, getIndex) -> schema.queryKey(args, unvisit, delegate)
BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object.We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument.
Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments.
/** Accessors to the currently processing state while building query */ export interface IQueryDelegate { getEntity: GetEntity; getIndex: GetIndex; }
Before
queryKey(args, queryKey, getEntity, getIndex) { getIndex(schema.key, indexName, value)[value]; getEntity(this.key, id); return queryKey(this.schema, args, getEntity, getIndex); }
After
queryKey(args, unvisit, delegate) { delegate.getIndex(schema.key, indexName, value); delegate.getEntity(this.key, id); return unvisit(this.schema, args); }
Patch Changes
-
#3449
1f491a9Thanks @ntucker! - Fix controller.get and controller.getQueryMeta 'state' argument types -
#3558
fcb7d7dThanks @ntucker! - Normalize delegate.invalidate() first argument only haskeyparam.indexesoptional param no longer provided as it was never used.normalize( input: any, parent: any, key: string | undefined, args: any[], visit: (...args: any) => any, delegate: INormalizeDelegate, ): string { delegate.invalidate({ key: this._entity.key }, pk); return pk; }
-
#3468
4dde1d6Thanks @ntucker! - Improve performance of get/denormalize for small responses- 10-20% performance improvement due to removing immutablejs check for every call
-
Updated dependencies [
1f491a9,fcb7d7d,1f491a9,4939456,d44d36a,4dde1d6,1f491a9]: