data-client

Async State Management without the Management

APACHE-2.0 License

Downloads
44.4K
Stars
1.9K
Committers
37

Bot releases are visible (Hide)

data-client - @rest-hooks/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • c8c5575e5a: Add 'paginationField' parameter to RestEndpoint and createResource

    This adds a 'getPage' member; similar to getList.push/unshift but for pagination.

    const TodoResource = createResource({
      path: '/todos/:id',
      schema: Todo,
      paginationField: 'page',
    }).getList.getPage({ page: '2' });
    

Patch Changes

  • c8c5575e5a: Fix case where sometimes paginating would not update a collection

    This was due to the comparison not using string serialization (canonical form for collection comparisons)

  • c8c5575e5a: Ignore 'undefined' parameters in collection matching

  • Updated dependencies [c8c5575e5a]

  • Updated dependencies [c8c5575e5a]

  • Updated dependencies [c8c5575e5a]

data-client - @rest-hooks/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

  • c8c5575e5a: Ignore 'undefined' parameters in collection matching
  • Updated dependencies [c8c5575e5a]
  • Updated dependencies [4e9d34ebc1]
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • c8c5575e5a: Add 'paginationField' parameter to RestEndpoint and createResource

    This adds a 'getPage' member; similar to getList.push/unshift but for pagination.

    const TodoResource = createResource({
      path: '/todos/:id',
      schema: Todo,
      paginationField: 'page',
    }).getList.getPage({ page: '2' });
    

Patch Changes

  • c8c5575e5a: Fix case where sometimes paginating would not update a collection

    This was due to the comparison not using string serialization (canonical form for collection comparisons)

  • c8c5575e5a: Ignore 'undefined' parameters in collection matching

  • Updated dependencies [c8c5575e5a]

  • Updated dependencies [4e9d34ebc1]

data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

  • c8c5575e5a: Ignore 'undefined' parameters in collection matching

  • 4e9d34ebc1: Optimistic creates no longer need a 'fake pk'

    e.g.,

    controller.fetch(TodoResource.getList.push, {
      // id: randomId(), THIS IS NO LONGER NEEDED
      userId,
      title: e.currentTarget.value,
    });
    

    This is achieved by computing a random id when a pk cannot be
    computed. In development mode non-create endpoints will
    still throw when pk fails.

data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • a78831dc61: Support latest version in peerDeps
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • a78831dc61: Support latest version in peerDeps
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • a78831dc61: Support latest version in peerDeps
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • a78831dc61: Support latest version in peerDeps
data-client - @rest-hooks/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • 6fd842e464: Add controller.expireAll() that sets all responses to STALE

    controller.expireAll(ArticleResource.getList);
    

    This is like controller.invalidateAll(); but will continue showing
    stale data while it is refetched.

    This is sometimes useful to trigger refresh of only data presently shown
    when there are many parameterizations in cache.

Patch Changes

data-client - @rest-hooks/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • af8b76079f: Support FormData in Resource updates and creates

Patch Changes

data-client - @rest-hooks/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • 6fd842e464: Add controller.expireAll() that sets all responses to STALE

    controller.expireAll(ArticleResource.getList);
    

    This is like controller.invalidateAll(); but will continue showing
    stale data while it is refetched.

    This is sometimes useful to trigger refresh of only data presently shown
    when there are many parameterizations in cache.

Patch Changes

  • Updated dependencies [6fd842e464]
  • Updated dependencies [6fd842e464]
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • af8b76079f: Support FormData in Resource updates and creates
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • 6fd842e464: Add controller.expireAll() that sets all responses to STALE

    controller.expireAll(ArticleResource.getList);
    

    This is like controller.invalidateAll(); but will continue showing
    stale data while it is refetched.

    This is sometimes useful to trigger refresh of only data presently shown
    when there are many parameterizations in cache.

Patch Changes

  • 6fd842e464: Update README examples to have more options configured
  • Updated dependencies [6fd842e464]
data-client - @rest-hooks/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • 6fd842e464: Add controller.expireAll() that sets all responses to STALE

    controller.expireAll(ArticleResource.getList);
    

    This is like controller.invalidateAll(); but will continue showing
    stale data while it is refetched.

    This is sometimes useful to trigger refresh of only data presently shown
    when there are many parameterizations in cache.

data-client - @rest-hooks/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • 51b4b0d188: Deprecate Resource.create

  • 51b4b0d188: Add Resource.extend()

    This is polymorphic, and has three forms

    Set any field based on arguments:

    Resource.extend('fieldName', { path: 'mypath/:id' });
    

    Override any of the provided endpoints with options:

    Resource.extend({
      getList: {
        path: 'mypath/:id',
      },
      update: {
        body: {} as Other,
      },
    });
    

    Function to compute derived endpoints:

    Resource.extend(base => ({
      getByComment: base.getList.extend({
        path: 'repos/:owner/:repo/issues/comments/:comment/reactions',
      }),
    }));
    

    Idea credits: @Dav3rs

  • 51b4b0d188: Remove createResource pagination field in favor of getList.paginated

Patch Changes

  • 51b4b0d188: Fix endpoint.push/unshift/assign method type
  • Updated dependencies [51b4b0d188]
  • Updated dependencies [51b4b0d188]
  • Updated dependencies [51b4b0d188]
  • Updated dependencies [51b4b0d188]
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

  • 384e7b7030: Fix commonjs rollup build
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Minor Changes

  • 51b4b0d188: Deprecate Resource.create

  • 51b4b0d188: Add Resource.extend()

    This is polymorphic, and has three forms

    Set any field based on arguments:

    Resource.extend('fieldName', { path: 'mypath/:id' });
    

    Override any of the provided endpoints with options:

    Resource.extend({
      getList: {
        path: 'mypath/:id',
      },
      update: {
        body: {} as Other,
      },
    });
    

    Function to compute derived endpoints:

    Resource.extend(base => ({
      getByComment: base.getList.extend({
        path: 'repos/:owner/:repo/issues/comments/:comment/reactions',
      }),
    }));
    

    Idea credits: @Dav3rs

  • 51b4b0d188: Remove createResource pagination field in favor of getList.paginated

Patch Changes

  • 51b4b0d188: Fix endpoint.push/unshift/assign method type
data-client - @data-client/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

  • 6e790725ae: Add more docstrings to RestEndpoint members
  • 27274bcf21: Allow DELETE to have body if specified
data-client - @rest-hooks/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

  • 8a71700644: fix: Support Collections with boolean parameters
  • Updated dependencies [8a71700644]
  • Updated dependencies [8a71700644]
  • Updated dependencies [8a71700644]