Repository navigation
📝 Read the full release announcement
Patch Changes
-
#4718
20d93f0- FixgetResponse()andgetResponseMeta()typingdataasundefinedfor endpoints without a schemaAffects Controller, Snapshot, and the
snapthatgetOptimisticResponse()receives.// store settings are plain JSON, so this endpoint has no schema const getSettings = new RestEndpoint({ path: '/settings', process(value): { taxRate: number } { return value; }, }); const addToCart = new RestEndpoint({ path: '/cart/items', method: 'POST', body: {} as { productId: string; price: number }, schema: CartItem, getOptimisticResponse(snap, body) { const { data: settings } = snap.getResponse(getSettings); return { ...body, id: `optimistic-${snap.fetchedAt}`, // Before: Property 'taxRate' does not exist on type 'never'. tax: body.price * (settings?.taxRate ?? 0), }; }, });
New exported types
EndpointData<E>andEndpointDataNullable<E>are whatuseSuspense(),useCache(),useDLE(),useLive()and these reads return. Use them to annotate your own helpers. Docs -
Updated dependencies [
20d93f0]:- @data-client/core@0.19.2