Minor Changes
-
#12971
d11eb40Thanks @jerelmiller! - Add support forfrom: nullinclient.watchFragmentandcache.watchFragment. Whenfromisnull, the emitted result is:{ data: null, dataState: "complete", complete: true, }
-
#12971
d11eb40Thanks @jerelmiller! - Add support for arrays withuseFragment,useSuspenseFragment, andclient.watchFragment. This allows the ability to use a fragment to watch multiple entities in the cache. Passing an array tofromwill returndataas an array where each array index corresponds to the index in thefromarray.function MyComponent() { const result = useFragment({ fragment, from: [item1, item2, item3], }); // `data` is an array with 3 items console.log(result); // { data: [{...}, {...}, {...}], dataState: "complete", complete: true } }
-
#12971
d11eb40Thanks @jerelmiller! - Add agetCurrentResultfunction to the observable returned byclient.watchFragmentandcache.watchFragmentthat returns the current value for the watched fragment.const observable = client.watchFragment({ fragment, from: { __typename: "Item", id: 1 }, }); console.log(observable.getCurrentResult()); // { // data: {...}, // dataState: "complete", // complete: true, // }
Patch Changes
-
#12971
d11eb40Thanks @jerelmiller! - Deduplicate watches created byuseFragment,client.watchFragment, andcache.watchFragmentthat contain the same fragment, variables, and identifier. This should improve performance in situations where auseFragmentor aclient.watchFragmentis used to watch the same object in multiple places of an application. -
#12982
5c56b32Thanks @jerelmiller! - Ignore top-leveldatavalues on subsequent chunks in incremental responses. -
#12982
5c56b32Thanks @jerelmiller! - Fix theDefer20220824Handler.SubsequentResulttype to match theFormattedSubsequentIncrementalExecutionResulttype ingraphql@17.0.0-alpha.2. -
#12973
072da24Thanks @jerelmiller! - Update theacceptheader used with theGraphQL17Alpha9Handlertomultipart/mixed;incrementalSpec=v0.2to ensure the newest incremental delivery format is requested. -
#12971
d11eb40Thanks @jerelmiller! -DeepPartial<Array<TData>>now returnsArray<DeepPartial<TData>>instead ofArray<DeepPartial<TData | undefined>>.