@raf-query/react 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -4
- package/README.md +1 -0
- package/dist/react-router.d.mts +35 -0
- package/dist/react-router.mjs +39 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.1](https://github.com/KATT/raf-query/compare/0.9.0...0.9.1) (2026-10-15)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **react:** add @raf-query/react/react-router for React Router Framework Mode ([#146](https://github.com/KATT/raf-query/issues/146)) ([4e02c80](https://github.com/KATT/raf-query/commit/4e02c809d8be1eea33935c9f0b6abc38cbdce25c)), references [#130](https://github.com/KATT/raf-query/issues/130) [#148](https://github.com/KATT/raf-query/issues/148) [#148](https://github.com/KATT/raf-query/issues/148)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* **lint:** ban member access on use(), in code and Markdown fences ([#155](https://github.com/KATT/raf-query/issues/155)) ([b7b37b4](https://github.com/KATT/raf-query/commit/b7b37b4f6d83c0a232697d05b177c33bdea11df1)), references [#140](https://github.com/KATT/raf-query/issues/140)
|
|
12
|
+
|
|
3
13
|
## [0.9.0](https://github.com/KATT/raf-query/compare/0.8.0...0.9.0) (2026-10-15)
|
|
4
14
|
|
|
5
15
|
### ⚠ BREAKING CHANGES
|
|
6
16
|
|
|
7
|
-
|
|
17
|
+
- useQuery returns the data for a handle from ensure or fetch ([#144](https://github.com/KATT/raf-query/issues/144))
|
|
8
18
|
|
|
9
19
|
### Features
|
|
10
20
|
|
|
11
|
-
|
|
21
|
+
- useQuery returns the data for a handle from ensure or fetch ([#144](https://github.com/KATT/raf-query/issues/144)) ([1845244](https://github.com/KATT/raf-query/commit/18452443ba61c205a53c4f71d60ec99a9b8620a7)), references [#142](https://github.com/KATT/raf-query/issues/142)
|
|
12
22
|
|
|
13
23
|
### Documentation
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
- call the early API a note about minor releases ([#143](https://github.com/KATT/raf-query/issues/143)) ([2d79eed](https://github.com/KATT/raf-query/commit/2d79eed7b107b6d16898ebb203a9bdfcfb3856c4))
|
|
26
|
+
- show prefetch and ensure, and make list queries infinite ([#140](https://github.com/KATT/raf-query/issues/140)) ([25cfaa0](https://github.com/KATT/raf-query/commit/25cfaa08f9f192af7efded1269f4ae8a9e5f1026))
|
|
17
27
|
|
|
18
28
|
## [0.8.0](https://github.com/KATT/raf-query/compare/0.7.12...0.8.0) (2026-10-15)
|
|
19
29
|
|
package/README.md
CHANGED
|
@@ -129,6 +129,7 @@ function PostPage() {
|
|
|
129
129
|
| `@raf-query/react` | `QueryClient`, `QueryClientProvider`, `useQuery`, `useWaterfall`, `useIsFetching`, and all of core |
|
|
130
130
|
| `@raf-query/react/tanstack-router` | [TanStack Start and Router](https://raf-query.katt.dev/docs/tanstack-start) SSR streaming |
|
|
131
131
|
| `@raf-query/react/rsc` | [React Server Components](https://raf-query.katt.dev/docs/nextjs), such as the Next.js App Router |
|
|
132
|
+
| `@raf-query/react/react-router` | [React Router](https://raf-query.katt.dev/docs/react-router) Framework Mode loaders |
|
|
132
133
|
| `@raf-query/react/devtools` | The [devtools](https://raf-query.katt.dev/docs/devtools) panel; omit the element to tree-shake it |
|
|
133
134
|
|
|
134
135
|
## License
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DehydratedState, HydrateOptions } from "@raf-query/core";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/react-router.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Writes a loader's dehydrated cache into the browser (or SSR) client.
|
|
6
|
+
* Use it with React Router Framework Mode: start queries in the loader,
|
|
7
|
+
* `dehydrate` the request's client, and pass that state here.
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* export async function loader(args: Route.LoaderArgs) {
|
|
11
|
+
* const qc = new QueryClient();
|
|
12
|
+
* const post = await qc.ensure(postQuery, { slug: args.params.slug });
|
|
13
|
+
* return { dehydratedState: dehydrate(qc), post };
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* export default function Page(props: Route.ComponentProps) {
|
|
17
|
+
* const { dehydratedState, post } = props.loaderData;
|
|
18
|
+
* return (
|
|
19
|
+
* <HydrationBoundary state={dehydratedState}>
|
|
20
|
+
* <Post handle={post} />
|
|
21
|
+
* </HydrationBoundary>
|
|
22
|
+
* );
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Pending entries cross as promises when the framework's serializer
|
|
27
|
+
* supports them (React Router's Single Fetch does). Nested boundaries
|
|
28
|
+
* are fine: each only writes what its `state` holds.
|
|
29
|
+
*/
|
|
30
|
+
export declare function HydrationBoundary(props: {
|
|
31
|
+
readonly children?: ReactNode;
|
|
32
|
+
readonly options?: HydrateOptions;
|
|
33
|
+
readonly state: DehydratedState;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
//#endregion
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Hydrate } from "./hydrate.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/react-router.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Writes a loader's dehydrated cache into the browser (or SSR) client.
|
|
7
|
+
* Use it with React Router Framework Mode: start queries in the loader,
|
|
8
|
+
* `dehydrate` the request's client, and pass that state here.
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* export async function loader(args: Route.LoaderArgs) {
|
|
12
|
+
* const qc = new QueryClient();
|
|
13
|
+
* const post = await qc.ensure(postQuery, { slug: args.params.slug });
|
|
14
|
+
* return { dehydratedState: dehydrate(qc), post };
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* export default function Page(props: Route.ComponentProps) {
|
|
18
|
+
* const { dehydratedState, post } = props.loaderData;
|
|
19
|
+
* return (
|
|
20
|
+
* <HydrationBoundary state={dehydratedState}>
|
|
21
|
+
* <Post handle={post} />
|
|
22
|
+
* </HydrationBoundary>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Pending entries cross as promises when the framework's serializer
|
|
28
|
+
* supports them (React Router's Single Fetch does). Nested boundaries
|
|
29
|
+
* are fine: each only writes what its `state` holds.
|
|
30
|
+
*/
|
|
31
|
+
function HydrationBoundary(props) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Hydrate, {
|
|
33
|
+
options: props.options,
|
|
34
|
+
state: props.state,
|
|
35
|
+
children: props.children
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { HydrationBoundary };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raf-query/react",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "React bindings for raf-query, a render-as-you-fetch query library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"query",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
".": "./dist/index.mjs",
|
|
36
36
|
"./devtools": "./dist/devtools.mjs",
|
|
37
37
|
"./rsc": "./dist/rsc.mjs",
|
|
38
|
+
"./react-router": "./dist/react-router.mjs",
|
|
38
39
|
"./tanstack-router": {
|
|
39
40
|
"workerd": "./dist/tanstack-router.mjs",
|
|
40
41
|
"worker": "./dist/tanstack-router.mjs",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
}
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"@raf-query/core": "0.9.
|
|
50
|
+
"@raf-query/core": "0.9.1"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"@tanstack/react-router": "^1.170.0",
|