Skip to content

@data-client/[email protected]

Choose a tag to compare

@github-actions github-actions released this 24 Feb 21:13
· 356 commits to master since this release
9267432

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]: