diff --git a/.changeset/collection-movewith.md b/.changeset/collection-movewith.md deleted file mode 100644 index ef13497c3f79..000000000000 --- a/.changeset/collection-movewith.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -'@data-client/endpoint': minor -'@data-client/rest': minor ---- - -Add `Collection.moveWith()` for custom move schemas - -Analogous to [`addWith()`](https://dataclient.io/rest/api/Collection#addWith), `moveWith()` constructs a custom move schema that controls how entities are added to their destination collection. The remove behavior is automatically derived from the collection type (Array or Values). - -New exports: `unshift` merge function for convenience. - -```ts -import { Collection, unshift } from '@data-client/rest'; - -class MyCollection extends Collection { - constructor(schema, options) { - super(schema, options); - this.move = this.moveWith(unshift); - } -} -``` diff --git a/.changeset/fix-searchparams-undefined-ts6.md b/.changeset/fix-searchparams-undefined-ts6.md deleted file mode 100644 index 7a54f580f217..000000000000 --- a/.changeset/fix-searchparams-undefined-ts6.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@data-client/rest': patch ---- - -Fix `searchParams: undefined` being widened to `any` in TypeScript 6 non-strict mode - -TypeScript 6.0 widens `undefined` to `any` during generic inference when `strictNullChecks` is off. -This caused `RestEndpoint` with `searchParams: undefined` to incorrectly accept arbitrary arguments. diff --git a/.changeset/fix-undefined-optional-params.md b/.changeset/fix-undefined-optional-params.md deleted file mode 100644 index 8bcf88f7e5d8..000000000000 --- a/.changeset/fix-undefined-optional-params.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@data-client/rest': patch ---- - -Fix `undefined` optional path params being interpolated as literal `"undefined"` in URLs diff --git a/.changeset/gcpolicy-unref-interval.md b/.changeset/gcpolicy-unref-interval.md deleted file mode 100644 index 35a39d5cbbbe..000000000000 --- a/.changeset/gcpolicy-unref-interval.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/core': patch ---- - -GCPolicy interval no longer blocks Node.js process exit - -Call `.unref()` on GCPolicy's `setInterval` in Node.js environments, preventing the GC sweep timer from keeping Jest workers or other Node.js processes alive. diff --git a/.changeset/moody-dots-drum.md b/.changeset/moody-dots-drum.md deleted file mode 100644 index 151b8c35cee6..000000000000 --- a/.changeset/moody-dots-drum.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -'@data-client/rest': minor ---- - -RestEndpoint.path and Resource.path syntax updated - -Upgrading path-to-regexp from 6 to 8. -- https://github.com/pillarjs/path-to-regexp/releases/tag/v8.0.0 -- https://github.com/pillarjs/path-to-regexp/releases/tag/v7.0.0 - -BREAKING CHANGES: -- /:optional? -> {/:optional} -- /:repeating+ -> /*repeating (typed as string[]) -- /:repeating* -> {/*repeating} (typed as string[]) -- /:id(\d+) -> /:id (custom regex removed) -- /:with-dash -> /:"with-dash" -- `(`, `)`, `[`, `]`, `+`, `?`, `!` must be escaped `"\\("` - - `{}()[]+?!:*\` are all characters that need escaping - -Migrate using: -`npx skills add https://github.com/reactive/data-client --skill path-to-regexp-v8-migration` \ No newline at end of file diff --git a/.changeset/test-auto-cleanup.md b/.changeset/test-auto-cleanup.md deleted file mode 100644 index 514c004d07ba..000000000000 --- a/.changeset/test-auto-cleanup.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -'@data-client/test': patch ---- - -Add automatic cleanup after each test - -[renderDataHook()](/docs/api/renderDataHook) and `makeRenderDataClient()` now register an `afterEach` hook at import time that automatically cleans up all active managers. Manual `renderDataHook.cleanup()` calls in `afterEach` are no longer needed. - -```ts -// Before: ❌ -afterEach(() => { - renderDataHook.cleanup(); -}); - -// After: ✓ (no afterEach needed — cleanup is automatic) -``` diff --git a/.changeset/test-per-render-cleanup.md b/.changeset/test-per-render-cleanup.md deleted file mode 100644 index 91c4b23497e1..000000000000 --- a/.changeset/test-per-render-cleanup.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -'@data-client/test': patch ---- - -Add per-render `cleanup()` and `allSettled()` to makeRenderDataHook return value - -Each `renderDataHook()` call now returns `cleanup` and `allSettled` directly on the result object, ensuring each render's managers can be independently cleaned up. This prevents manager leaks when `renderDataHook()` is called multiple times in a test. - -New exports: `RenderDataHookResult` - -```ts -const { result, cleanup, allSettled } = renderDataHook( - () => useSuspense(MyResource.get, { id: 5 }), - { initialFixtures }, -); -// ... assertions ... -cleanup(); -``` diff --git a/.changeset/usefetch-stable-promise.md b/.changeset/usefetch-stable-promise.md deleted file mode 100644 index ea26ac5e806e..000000000000 --- a/.changeset/usefetch-stable-promise.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -'@data-client/react': major -'@data-client/vue': major ---- - -BREAKING CHANGE: [useFetch()](/docs/api/useFetch) always returns a stable promise with a `.resolved` property, even when data is already cached. - -#### before - -```tsx -const promise = useFetch(MyResource.get, { id }); -if (promise) { - // fetch was triggered -} -``` - -#### after - -```tsx -const promise = useFetch(MyResource.get, { id }); -if (!promise.resolved) { - // fetch is in-flight -} -use(promise); // works with React.use() -``` \ No newline at end of file diff --git a/.changeset/usefetch-usable-thenable.md b/.changeset/usefetch-usable-thenable.md deleted file mode 100644 index 146a04068cc9..000000000000 --- a/.changeset/usefetch-usable-thenable.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -'@data-client/react': minor ---- - -`useFetch()` returns a [UsablePromise](https://react.dev/reference/react/use) thenable with denormalized data, error handling, and GC tracking. `use(useFetch(endpoint, args))` now behaves identically to `useSuspense(endpoint, args)` — suspending when data is loading, returning denormalized data when cached, throwing on errors, and re-suspending on invalidation. - -Parallel fetches are supported since all `useFetch()` calls execute before any `use()` suspends: - -```tsx -const postPromise = useFetch(PostResource.get, { id }); -const commentsPromise = useFetch(CommentResource.getList, { postId: id }); -const post = use(postPromise); -const comments = use(commentsPromise); -``` diff --git a/examples/benchmark-react/CHANGELOG.md b/examples/benchmark-react/CHANGELOG.md new file mode 100644 index 000000000000..2f6912567ef7 --- /dev/null +++ b/examples/benchmark-react/CHANGELOG.md @@ -0,0 +1,11 @@ +# example-benchmark-react + +## 0.1.1 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758), [`3b85c82`](https://github.com/reactive/data-client/commit/3b85c820f8046a056d9180ff5d2fe1a883b6998c), [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14), [`0e0ff1a`](https://github.com/reactive/data-client/commit/0e0ff1ab49b1a58477b07dba3dfc73df6d4af3f5), [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14), [`3c3bfe8`](https://github.com/reactive/data-client/commit/3c3bfe81ff0c3a786d6804a61f9e7a4362947dcb), [`5783267`](https://github.com/reactive/data-client/commit/5783267d60b9292c834da76aa95732ef466f413b)]: + - @data-client/endpoint@1.0.0 + - @data-client/rest@1.0.0 + - @data-client/core@1.0.0 + - @data-client/react@1.0.0 diff --git a/examples/benchmark-react/package.json b/examples/benchmark-react/package.json index 64a4eab378aa..6ec302436344 100644 --- a/examples/benchmark-react/package.json +++ b/examples/benchmark-react/package.json @@ -1,6 +1,6 @@ { "name": "example-benchmark-react", - "version": "0.1.0", + "version": "0.1.1", "private": true, "description": "React rendering benchmark comparing @data-client/react against other data libraries", "scripts": { diff --git a/examples/benchmark/CHANGELOG.md b/examples/benchmark/CHANGELOG.md index e7037b9b1def..589a3c048e12 100644 --- a/examples/benchmark/CHANGELOG.md +++ b/examples/benchmark/CHANGELOG.md @@ -1,5 +1,14 @@ # example-benchmark +## 0.4.81 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758), [`0e0ff1a`](https://github.com/reactive/data-client/commit/0e0ff1ab49b1a58477b07dba3dfc73df6d4af3f5)]: + - @data-client/endpoint@1.0.0 + - @data-client/core@1.0.0 + - @data-client/normalizr@0.15.4 + ## 0.4.80 ### Patch Changes diff --git a/examples/benchmark/package.json b/examples/benchmark/package.json index a0635c7a2ef8..f7701c617aa2 100644 --- a/examples/benchmark/package.json +++ b/examples/benchmark/package.json @@ -1,6 +1,6 @@ { "name": "example-benchmark", - "version": "0.4.80", + "version": "0.4.81", "description": "Benchmark for normalizr", "main": "index.js", "author": "Nathaniel Tucker", diff --git a/examples/coin-app/CHANGELOG.md b/examples/coin-app/CHANGELOG.md index 75661751e402..e9d0fc8f4cb5 100644 --- a/examples/coin-app/CHANGELOG.md +++ b/examples/coin-app/CHANGELOG.md @@ -1,5 +1,14 @@ # coinbase-lite +## 0.0.16 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758), [`3b85c82`](https://github.com/reactive/data-client/commit/3b85c820f8046a056d9180ff5d2fe1a883b6998c), [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14), [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14), [`3c3bfe8`](https://github.com/reactive/data-client/commit/3c3bfe81ff0c3a786d6804a61f9e7a4362947dcb), [`5783267`](https://github.com/reactive/data-client/commit/5783267d60b9292c834da76aa95732ef466f413b)]: + - @data-client/rest@1.0.0 + - @data-client/react@1.0.0 + - @data-client/img@1.0.0 + ## 0.0.15 ### Patch Changes diff --git a/examples/coin-app/package.json b/examples/coin-app/package.json index daaede227306..b69349794ec4 100644 --- a/examples/coin-app/package.json +++ b/examples/coin-app/package.json @@ -1,6 +1,6 @@ { "name": "coinbase-lite", - "version": "0.0.15", + "version": "0.0.16", "packageManager": "yarn@4.12.0", "description": "Coin App", "scripts": { @@ -44,9 +44,9 @@ "@anansi/core": "0.22.8", "@anansi/router": "0.10.22", "@babel/runtime-corejs3": "7.29.0", - "@data-client/img": "0.15.0", - "@data-client/react": "0.15.7", - "@data-client/rest": "0.15.7", + "@data-client/img": "1.0.0", + "@data-client/react": "1.0.0", + "@data-client/rest": "1.0.0", "core-js": "3.48.0", "d3": "7.9.0", "history": "*", diff --git a/examples/normalizr-github/CHANGELOG.md b/examples/normalizr-github/CHANGELOG.md index 8bdaa2fcbfe2..e4ca1aa56353 100644 --- a/examples/normalizr-github/CHANGELOG.md +++ b/examples/normalizr-github/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-github-example +## 0.1.56 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758)]: + - @data-client/endpoint@1.0.0 + - @data-client/normalizr@0.15.4 + ## 0.1.55 ### Patch Changes diff --git a/examples/normalizr-github/package.json b/examples/normalizr-github/package.json index 40450cbc4699..d0ce5bd6baab 100644 --- a/examples/normalizr-github/package.json +++ b/examples/normalizr-github/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-github-example", - "version": "0.1.55", + "version": "0.1.56", "description": "And example of using Normalizr with github", "main": "index.js", "author": "Paul Armstrong", diff --git a/examples/normalizr-redux/CHANGELOG.md b/examples/normalizr-redux/CHANGELOG.md index ab32f814f7a9..8da59d390336 100644 --- a/examples/normalizr-redux/CHANGELOG.md +++ b/examples/normalizr-redux/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-redux-example +## 0.1.54 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758)]: + - @data-client/endpoint@1.0.0 + - @data-client/normalizr@0.15.4 + ## 0.1.53 ### Patch Changes diff --git a/examples/normalizr-redux/package.json b/examples/normalizr-redux/package.json index b7aac340ffa2..4597e89fad99 100644 --- a/examples/normalizr-redux/package.json +++ b/examples/normalizr-redux/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-redux-example", - "version": "0.1.53", + "version": "0.1.54", "description": "And example of using Normalizr with Redux", "main": "index.js", "author": "Paul Armstrong", diff --git a/examples/normalizr-relationships/CHANGELOG.md b/examples/normalizr-relationships/CHANGELOG.md index 3e87f4d31616..7b9940768dd1 100644 --- a/examples/normalizr-relationships/CHANGELOG.md +++ b/examples/normalizr-relationships/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-relationships +## 0.1.56 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758)]: + - @data-client/endpoint@1.0.0 + - @data-client/normalizr@0.15.4 + ## 0.1.55 ### Patch Changes diff --git a/examples/normalizr-relationships/package.json b/examples/normalizr-relationships/package.json index 854179707c9e..c368f1221066 100644 --- a/examples/normalizr-relationships/package.json +++ b/examples/normalizr-relationships/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-relationships", - "version": "0.1.55", + "version": "0.1.56", "description": "And example of using Normalizr with relationships", "main": "index.js", "author": "Paul Armstrong", diff --git a/examples/test-bundlesize/CHANGELOG.md b/examples/test-bundlesize/CHANGELOG.md index 982c238e50dd..4302ab51d56c 100644 --- a/examples/test-bundlesize/CHANGELOG.md +++ b/examples/test-bundlesize/CHANGELOG.md @@ -1,5 +1,14 @@ # test-bundlesize +## 0.1.8 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758), [`3b85c82`](https://github.com/reactive/data-client/commit/3b85c820f8046a056d9180ff5d2fe1a883b6998c), [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14), [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14), [`3c3bfe8`](https://github.com/reactive/data-client/commit/3c3bfe81ff0c3a786d6804a61f9e7a4362947dcb), [`5783267`](https://github.com/reactive/data-client/commit/5783267d60b9292c834da76aa95732ef466f413b)]: + - @data-client/rest@1.0.0 + - @data-client/react@1.0.0 + - @data-client/img@1.0.0 + ## 0.1.7 ### Patch Changes diff --git a/examples/test-bundlesize/package.json b/examples/test-bundlesize/package.json index 131e539239d0..7a4d521b2593 100644 --- a/examples/test-bundlesize/package.json +++ b/examples/test-bundlesize/package.json @@ -1,6 +1,6 @@ { "name": "test-bundlesize", - "version": "0.1.7", + "version": "0.1.8", "packageManager": "yarn@4.12.0", "description": "Testing Bundled Size", "scripts": { diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index ee2bf6551aa9..63a335fe6160 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,16 @@ # @data-client/core +## 1.0.0 + +### Patch Changes + +- [#3774](https://github.com/reactive/data-client/pull/3774) [`0e0ff1a`](https://github.com/reactive/data-client/commit/0e0ff1ab49b1a58477b07dba3dfc73df6d4af3f5) - GCPolicy interval no longer blocks Node.js process exit + + Call `.unref()` on GCPolicy's `setInterval` in Node.js environments, preventing the GC sweep timer from keeping Jest workers or other Node.js processes alive. + +- Updated dependencies []: + - @data-client/normalizr@0.15.4 + ## 0.15.7 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index b2e81ca7bbf2..e593d6c788dc 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/core", - "version": "0.15.7", + "version": "1.0.0", "description": "Async State Management without the Management. REST, GraphQL, SSE, Websockets, Fetch", "sideEffects": false, "main": "dist/index.js", diff --git a/packages/endpoint/CHANGELOG.md b/packages/endpoint/CHANGELOG.md index b679957d8149..886f9c09ecb5 100644 --- a/packages/endpoint/CHANGELOG.md +++ b/packages/endpoint/CHANGELOG.md @@ -1,5 +1,26 @@ # @data-client/endpoint +## 1.0.0 + +### Minor Changes + +- [#3783](https://github.com/reactive/data-client/pull/3783) [`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758) - Add `Collection.moveWith()` for custom move schemas + + Analogous to [`addWith()`](https://dataclient.io/rest/api/Collection#addWith), `moveWith()` constructs a custom move schema that controls how entities are added to their destination collection. The remove behavior is automatically derived from the collection type (Array or Values). + + New exports: `unshift` merge function for convenience. + + ```ts + import { Collection, unshift } from '@data-client/rest'; + + class MyCollection extends Collection { + constructor(schema, options) { + super(schema, options); + this.move = this.moveWith(unshift); + } + } + ``` + ## 0.15.7 ### Patch Changes diff --git a/packages/endpoint/package.json b/packages/endpoint/package.json index 7666b3bd9809..5877d327d04e 100644 --- a/packages/endpoint/package.json +++ b/packages/endpoint/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/endpoint", - "version": "0.15.7", + "version": "1.0.0", "description": "Declarative Network Interface Definitions", "homepage": "https://dataclient.io/docs/guides/custom-protocol", "keywords": [ diff --git a/packages/graphql/CHANGELOG.md b/packages/graphql/CHANGELOG.md index 4a7e159a3917..90e7169e4d84 100644 --- a/packages/graphql/CHANGELOG.md +++ b/packages/graphql/CHANGELOG.md @@ -1,5 +1,12 @@ # @data-client/graphql +## 1.0.0 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758)]: + - @data-client/endpoint@1.0.0 + ## 0.15.7 ### Patch Changes diff --git a/packages/graphql/package.json b/packages/graphql/package.json index a349389be7c2..37c19101f1d6 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/graphql", - "version": "0.15.7", + "version": "1.0.0", "description": "Quickly define typed GraphQL resources and endpoints", "homepage": "https://dataclient.io/docs/graphql", "repository": { diff --git a/packages/img/CHANGELOG.md b/packages/img/CHANGELOG.md index 47913ba9c430..c82ec4522d44 100644 --- a/packages/img/CHANGELOG.md +++ b/packages/img/CHANGELOG.md @@ -1,5 +1,13 @@ # @data-client/img +## 1.0.0 + +### Patch Changes + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758), [`3c3bfe8`](https://github.com/reactive/data-client/commit/3c3bfe81ff0c3a786d6804a61f9e7a4362947dcb), [`5783267`](https://github.com/reactive/data-client/commit/5783267d60b9292c834da76aa95732ef466f413b)]: + - @data-client/endpoint@1.0.0 + - @data-client/react@1.0.0 + ## 0.15.0 ### Minor Changes diff --git a/packages/img/package.json b/packages/img/package.json index e1fe2e7b3bcc..8dd108ce1dd6 100644 --- a/packages/img/package.json +++ b/packages/img/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/img", - "version": "0.15.0", + "version": "1.0.0", "description": "Suspenseful images", "homepage": "https://dataclient.io/docs/guides/img-media#just-images", "repository": { @@ -78,7 +78,7 @@ "@data-client/endpoint": "workspace:^" }, "peerDependencies": { - "@data-client/react": "^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0", + "@data-client/react": "^1.0.0", "@types/react": "^16.14.0 || ^17.0.0 || ^18.0.0-0 || ^19.0.0", "react": "^16.14.0 || ^17.0.0 || ^18.0.0-0 || ^19.0.0" }, diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 11aaa5e0a1ed..d243529fd546 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,48 @@ # @data-client/react +## 1.0.0 + +### Major Changes + +- [#3752](https://github.com/reactive/data-client/pull/3752) [`3c3bfe8`](https://github.com/reactive/data-client/commit/3c3bfe81ff0c3a786d6804a61f9e7a4362947dcb) - BREAKING CHANGE: [useFetch()](/docs/api/useFetch) always returns a stable promise with a `.resolved` property, even when data is already cached. + + #### before + + ```tsx + const promise = useFetch(MyResource.get, { id }); + if (promise) { + // fetch was triggered + } + ``` + + #### after + + ```tsx + const promise = useFetch(MyResource.get, { id }); + if (!promise.resolved) { + // fetch is in-flight + } + use(promise); // works with React.use() + ``` + +### Minor Changes + +- [#3755](https://github.com/reactive/data-client/pull/3755) [`5783267`](https://github.com/reactive/data-client/commit/5783267d60b9292c834da76aa95732ef466f413b) - `useFetch()` returns a [UsablePromise](https://react.dev/reference/react/use) thenable with denormalized data, error handling, and GC tracking. `use(useFetch(endpoint, args))` now behaves identically to `useSuspense(endpoint, args)` — suspending when data is loading, returning denormalized data when cached, throwing on errors, and re-suspending on invalidation. + + Parallel fetches are supported since all `useFetch()` calls execute before any `use()` suspends: + + ```tsx + const postPromise = useFetch(PostResource.get, { id }); + const commentsPromise = useFetch(CommentResource.getList, { postId: id }); + const post = use(postPromise); + const comments = use(commentsPromise); + ``` + +### Patch Changes + +- Updated dependencies [[`0e0ff1a`](https://github.com/reactive/data-client/commit/0e0ff1ab49b1a58477b07dba3dfc73df6d4af3f5)]: + - @data-client/core@1.0.0 + ## 0.15.7 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index 5faec1f06655..2adc7c168b98 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/react", - "version": "0.15.7", + "version": "1.0.0", "description": "Async State Management without the Management. REST, GraphQL, SSE, Websockets, Fetch", "homepage": "https://dataclient.io", "repository": { diff --git a/packages/rest/CHANGELOG.md b/packages/rest/CHANGELOG.md index 9a15fea34fd1..b16326265f17 100644 --- a/packages/rest/CHANGELOG.md +++ b/packages/rest/CHANGELOG.md @@ -1,5 +1,56 @@ # @data-client/rest +## 1.0.0 + +### Minor Changes + +- [#3783](https://github.com/reactive/data-client/pull/3783) [`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758) - Add `Collection.moveWith()` for custom move schemas + + Analogous to [`addWith()`](https://dataclient.io/rest/api/Collection#addWith), `moveWith()` constructs a custom move schema that controls how entities are added to their destination collection. The remove behavior is automatically derived from the collection type (Array or Values). + + New exports: `unshift` merge function for convenience. + + ```ts + import { Collection, unshift } from '@data-client/rest'; + + class MyCollection extends Collection { + constructor(schema, options) { + super(schema, options); + this.move = this.moveWith(unshift); + } + } + ``` + +- [#3757](https://github.com/reactive/data-client/pull/3757) [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14) - RestEndpoint.path and Resource.path syntax updated + + Upgrading path-to-regexp from 6 to 8. + - https://github.com/pillarjs/path-to-regexp/releases/tag/v8.0.0 + - https://github.com/pillarjs/path-to-regexp/releases/tag/v7.0.0 + + BREAKING CHANGES: + - /:optional? -> {/:optional} + - /:repeating+ -> /\*repeating (typed as string[]) + - /:repeating* -> {/*repeating} (typed as string[]) + - /:id(\d+) -> /:id (custom regex removed) + - /:with-dash -> /:"with-dash" + - `(`, `)`, `[`, `]`, `+`, `?`, `!` must be escaped `"\\("` + - `{}()[]+?!:*\` are all characters that need escaping + + Migrate using: + `npx skills add https://github.com/reactive/data-client --skill path-to-regexp-v8-migration` + +### Patch Changes + +- [#3782](https://github.com/reactive/data-client/pull/3782) [`3b85c82`](https://github.com/reactive/data-client/commit/3b85c820f8046a056d9180ff5d2fe1a883b6998c) - Fix `searchParams: undefined` being widened to `any` in TypeScript 6 non-strict mode + + TypeScript 6.0 widens `undefined` to `any` during generic inference when `strictNullChecks` is off. + This caused `RestEndpoint` with `searchParams: undefined` to incorrectly accept arbitrary arguments. + +- [#3757](https://github.com/reactive/data-client/pull/3757) [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14) - Fix `undefined` optional path params being interpolated as literal `"undefined"` in URLs + +- Updated dependencies [[`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758)]: + - @data-client/endpoint@1.0.0 + ## 0.15.7 ### Patch Changes diff --git a/packages/rest/package.json b/packages/rest/package.json index 85e9a2317136..acff7c6925ef 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/rest", - "version": "0.15.7", + "version": "1.0.0", "description": "Quickly define typed REST resources and endpoints", "homepage": "https://dataclient.io/rest", "repository": { diff --git a/packages/test/CHANGELOG.md b/packages/test/CHANGELOG.md index 68e6d6fbf47a..663f52f624a2 100644 --- a/packages/test/CHANGELOG.md +++ b/packages/test/CHANGELOG.md @@ -1,5 +1,40 @@ # @data-client/test +## 1.0.0 + +### Patch Changes + +- [#3774](https://github.com/reactive/data-client/pull/3774) [`0e0ff1a`](https://github.com/reactive/data-client/commit/0e0ff1ab49b1a58477b07dba3dfc73df6d4af3f5) - Add automatic cleanup after each test + + [renderDataHook()](/docs/api/renderDataHook) and `makeRenderDataClient()` now register an `afterEach` hook at import time that automatically cleans up all active managers. Manual `renderDataHook.cleanup()` calls in `afterEach` are no longer needed. + + ```ts + // Before: ❌ + afterEach(() => { + renderDataHook.cleanup(); + }); + + // After: ✓ (no afterEach needed — cleanup is automatic) + ``` + +- [#3772](https://github.com/reactive/data-client/pull/3772) [`1a20f4e`](https://github.com/reactive/data-client/commit/1a20f4e66c232aa9d4204861b2c2bcec77131b42) - Add per-render `cleanup()` and `allSettled()` to makeRenderDataHook return value + + Each `renderDataHook()` call now returns `cleanup` and `allSettled` directly on the result object, ensuring each render's managers can be independently cleaned up. This prevents manager leaks when `renderDataHook()` is called multiple times in a test. + + New exports: `RenderDataHookResult` + + ```ts + const { result, cleanup, allSettled } = renderDataHook( + () => useSuspense(MyResource.get, { id: 5 }), + { initialFixtures }, + ); + // ... assertions ... + cleanup(); + ``` + +- Updated dependencies [[`3c3bfe8`](https://github.com/reactive/data-client/commit/3c3bfe81ff0c3a786d6804a61f9e7a4362947dcb), [`5783267`](https://github.com/reactive/data-client/commit/5783267d60b9292c834da76aa95732ef466f413b)]: + - @data-client/react@1.0.0 + ## 0.15.3 ### Patch Changes diff --git a/packages/test/package.json b/packages/test/package.json index 413d318556f0..5f7eb30a150b 100644 --- a/packages/test/package.json +++ b/packages/test/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/test", - "version": "0.15.3", + "version": "1.0.0", "description": "Testing utilities for Data Client", "homepage": "https://dataclient.io/docs/guides/storybook", "repository": { @@ -120,7 +120,7 @@ "@testing-library/react": "^16.0.0" }, "peerDependencies": { - "@data-client/react": "^0.12.15 || ^0.13.0 || ^0.14.0 || ^0.15.0", + "@data-client/react": "^1.0.0", "@testing-library/react-hooks": "^8.0.0", "@testing-library/react-native": "^13.0.0", "@types/react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-0 || ^19.0.0", diff --git a/packages/vue/CHANGELOG.md b/packages/vue/CHANGELOG.md index 2a1b31487a0e..0cfa13488215 100644 --- a/packages/vue/CHANGELOG.md +++ b/packages/vue/CHANGELOG.md @@ -1,5 +1,35 @@ # @data-client/vue +## 1.0.0 + +### Major Changes + +- [#3752](https://github.com/reactive/data-client/pull/3752) [`3c3bfe8`](https://github.com/reactive/data-client/commit/3c3bfe81ff0c3a786d6804a61f9e7a4362947dcb) - BREAKING CHANGE: [useFetch()](/docs/api/useFetch) always returns a stable promise with a `.resolved` property, even when data is already cached. + + #### before + + ```tsx + const promise = useFetch(MyResource.get, { id }); + if (promise) { + // fetch was triggered + } + ``` + + #### after + + ```tsx + const promise = useFetch(MyResource.get, { id }); + if (!promise.resolved) { + // fetch is in-flight + } + use(promise); // works with React.use() + ``` + +### Patch Changes + +- Updated dependencies [[`0e0ff1a`](https://github.com/reactive/data-client/commit/0e0ff1ab49b1a58477b07dba3dfc73df6d4af3f5)]: + - @data-client/core@1.0.0 + ## 0.15.4 ### Patch Changes diff --git a/packages/vue/package.json b/packages/vue/package.json index bf492f17e531..f1ca53173f84 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/vue", - "version": "0.15.4", + "version": "1.0.0", "description": "Async State Management without the Management. REST, GraphQL, SSE, Websockets, Fetch", "homepage": "https://dataclient.io", "repository": { diff --git a/yarn.lock b/yarn.lock index 8ce5b5774989..12297f5c4a27 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3436,7 +3436,7 @@ __metadata: languageName: unknown linkType: soft -"@data-client/img@npm:0.15.0, @data-client/img@workspace:*, @data-client/img@workspace:packages/img": +"@data-client/img@npm:1.0.0, @data-client/img@workspace:*, @data-client/img@workspace:packages/img": version: 0.0.0-use.local resolution: "@data-client/img@workspace:packages/img" dependencies: @@ -3454,7 +3454,7 @@ __metadata: react-dom: "npm:^19.2.1" rollup-plugins: "workspace:*" peerDependencies: - "@data-client/react": ^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0 + "@data-client/react": ^1.0.0 "@types/react": ^16.14.0 || ^17.0.0 || ^18.0.0-0 || ^19.0.0 react: ^16.14.0 || ^17.0.0 || ^18.0.0-0 || ^19.0.0 peerDependenciesMeta: @@ -3478,7 +3478,7 @@ __metadata: languageName: unknown linkType: soft -"@data-client/react@npm:0.15.7, @data-client/react@workspace:*, @data-client/react@workspace:packages/react": +"@data-client/react@npm:1.0.0, @data-client/react@workspace:*, @data-client/react@workspace:packages/react": version: 0.0.0-use.local resolution: "@data-client/react@workspace:packages/react" dependencies: @@ -3522,7 +3522,7 @@ __metadata: languageName: unknown linkType: soft -"@data-client/rest@npm:0.15.7, @data-client/rest@workspace:*, @data-client/rest@workspace:packages/rest": +"@data-client/rest@npm:1.0.0, @data-client/rest@workspace:*, @data-client/rest@workspace:packages/rest": version: 0.0.0-use.local resolution: "@data-client/rest@workspace:packages/rest" dependencies: @@ -3561,7 +3561,7 @@ __metadata: react-test-renderer: "npm:*" rollup-plugins: "workspace:*" peerDependencies: - "@data-client/react": ^0.12.15 || ^0.13.0 || ^0.14.0 || ^0.15.0 + "@data-client/react": ^1.0.0 "@testing-library/react-hooks": ^8.0.0 "@testing-library/react-native": ^13.0.0 "@types/react": ^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-0 || ^19.0.0 @@ -11657,9 +11657,9 @@ __metadata: "@anansi/webpack-config": "npm:21.1.15" "@babel/core": "npm:7.29.0" "@babel/runtime-corejs3": "npm:7.29.0" - "@data-client/img": "npm:0.15.0" - "@data-client/react": "npm:0.15.7" - "@data-client/rest": "npm:0.15.7" + "@data-client/img": "npm:1.0.0" + "@data-client/react": "npm:1.0.0" + "@data-client/rest": "npm:1.0.0" "@linaria/core": "npm:*" "@linaria/react": "npm:*" "@linaria/shaker": "npm:*"