Skip to content

Releases: reactive/data-client

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

  • 060d8e1 Thanks @ntucker! - Update @testing-library/react-native to v13

  • #3365 66e7336 Thanks @ntucker! - fix: Interceptors work on manager-dispatched actions.

    For example, renderHook now can use resolverFixtures to resolve fetches for subscriptions.
    This was not possible before as SubscriptionManager's dispatches would not be intercepted with the
    previous implementation.

  • #3371 679d76a Thanks @ntucker! - Add react-native entry to package.json exports

  • #3353 165afed Thanks @renovate! - Polyfills no longer pollute global scope

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

  • #3343 1df829e Thanks @ntucker! - Add gcPolicy option to DataProvider and prepareStore

    // run GC sweep every 10min
    <DataProvider gcPolicy={new GCPolicy({ intervalMS: 60 * 1000 * 10 })}>
      {children}
    </DataProvider>
    const { store, selector, controller } = prepareStore(
      initialState,
      managers,
      Controller,
      otherReducers,
      extraMiddlewares,
      gcPolicy: new GCPolicy({ intervalMS: 60 * 1000 * 10 }),
    );

    To maintain existing behavior, use ImmortalGCPolicy:

    import { ImmortalGCPolicy, DataProvider } from '@data-client/react';
    
    <DataProvider gcPolicy={new ImmortalGCPolicy()}>{children}</DataProvider>;
  • #3343 1df829e Thanks @ntucker! - Add GCPolicy to control Garbage Collection of data in the store.

    This can be configured with constructor options, or custom GCPolicies implemented by extending
    or simply building your own. Use ImmortalGCPolicy to never GC (to maintain existing behavior).

    constructor

    intervalMS = 60 * 1000 * 5

    How long between low priority GC sweeps.

    Longer values may result in more memory usage, but less performance impact.

    expiryMultiplier = 2

    Used in the default hasExpired policy.

    Represents how many 'stale' lifetimes data should persist before being
    garbage collected.

    expiresAt

    expiresAt({
        fetchedAt,
        expiresAt,
    }: {
      expiresAt: number;
      date: number;
      fetchedAt: number;
    }): number {
      return (
        Math.max(
          (expiresAt - fetchedAt) * this.options.expiryMultiplier,
          120000,
        ) + fetchedAt
      );
    }

    Indicates at what timestamp it is acceptable to remove unused data from the store.

    Data not currently rendered in any components is considered unused. However, unused
    data may be used again in the future (as a cache).

    This results in a tradeoff between memory usage and cache hit rate (and thus performance).

  • #3371 679d76a Thanks @ntucker! - Add react-native entry to package.json exports

  • 12bb010 Thanks @ntucker! - Update async boundary link in BackupLoading component

  • #3353 165afed Thanks @renovate! - Polyfills no longer pollute global scope

  • Updated dependencies [1df829e, f796b6c, f796b6c, 66e7336, 1df829e, 679d76a, 165afed]:

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

@data-client/[email protected]

24 Feb 21:13
9267432
Compare
Choose a tag to compare

Patch Changes

  • #3343 1df829e Thanks @ntucker! - Add initManager()

  • #3373 f796b6c Thanks @ntucker! - Add Controller.getQueryMeta and Controller.getResponseMeta

  • #3373 f796b6c Thanks @ntucker! - Controller.snapshot() methods have stronger argument typing

  • #3365 66e7336 Thanks @ntucker! - internal: Controller.bindMiddleware() to be used in applyMiddleware.

    This API is not intended to be used elsewhere, but will become the standard interface between
    Controller's and applyMiddleware.

  • #3343 1df829e Thanks @ntucker! - Add GCPolicy to control Garbage Collection of data in the store.

    This can be configured with constructor options, or custom GCPolicies implemented by extending
    or simply building your own. Use ImmortalGCPolicy to never GC (to maintain existing behavior).

    constructor

    intervalMS = 60 * 1000 * 5

    How long between low priority GC sweeps.

    Longer values may result in more memory usage, but less performance impact.

    expiryMultiplier = 2

    Used in the default hasExpired policy.

    Represents how many 'stale' lifetimes data should persist before being
    garbage collected.

    expiresAt

    expiresAt({
        fetchedAt,
        expiresAt,
    }: {
      expiresAt: number;
      date: number;
      fetchedAt: number;
    }): number {
      return (
        Math.max(
          (expiresAt - fetchedAt) * this.options.expiryMultiplier,
          120000,
        ) + fetchedAt
      );
    }

    Indicates at what timestamp it is acceptable to remove unused data from the store.

    Data not currently rendered in any components is considered unused. However, unused
    data may be used again in the future (as a cache).

    This results in a tradeoff between memory usage and cache hit rate (and thus performance).

  • #3371 679d76a Thanks @ntucker! - Add react-native entry to package.json exports

  • #3353 165afed Thanks @renovate! - Polyfills no longer pollute global scope

  • Updated dependencies [679d76a, 165afed]:

@data-client/[email protected]

28 Dec 19:03
af07e7a
Compare
Choose a tag to compare

Patch Changes

  • #3333 1777546 Thanks @renovate! - Resource.extend() compatibility with TypeScript 5

    Previously extending existing members with no
    typed overrides (like path) would not work starting with
    TypeScript 5.7.

    const UserResource = UserResourceBase.extend({
      partialUpdate: {
        getOptimisticResponse(snap, params, body) {
          params.id;
          params.group;
          // @ts-expect-error
          params.nothere;
          return {
            id: params.id,
            ...body,
          };
        },
      },
    });