@ahoo-wang/wow-react 9.8.0 → 9.9.0

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/README.md CHANGED
@@ -135,6 +135,12 @@ Fetcher sends the request. The snapshot routes of an aggregate are
135
135
  `{aggregate}/snapshot/count`, behind the context alias and the owner or tenant
136
136
  path when the aggregate has them.
137
137
 
138
+ A request is identified by `url` and the Fetcher: a named Fetcher by its name,
139
+ an unnamed one by its `baseURL`. Two unnamed Fetchers with the same `baseURL`
140
+ count as one endpoint even when their interceptors differ (for example one per
141
+ tenant), so switching between them does not run the query again. Give each a
142
+ name, or pass the name of a registered Fetcher, to tell them apart.
143
+
138
144
  ## Streaming a list
139
145
 
140
146
  `useListStreamQuery` and `useFetcherListStreamQuery` read a list as
@@ -202,7 +208,9 @@ result and the error.
202
208
  A failed request and `abort()` keep the last `result`, so a failed refresh does
203
209
  not blank the screen; `reset()` aborts the request in flight and clears
204
210
  `result` and `error`. A hook that runs on mount renders its first frame, on the
205
- server too, as `loading`.
211
+ server too, as `loading`, and sends no request during server rendering. There
212
+ is no `initialResult` option: server-rendered HTML holds the loading state, and
213
+ the query runs once the page hydrates.
206
214
 
207
215
  Every hook returns `status`, `loading`, `result` (`items` and `done` for a
208
216
  stream), `error`, `execute`, `abort`, `reset`, `getQuery` and `setQuery`. The
package/README.zh-CN.md CHANGED
@@ -124,6 +124,10 @@ export function PaidOrders() {
124
124
  一个聚合的快照路由是 `{aggregate}/snapshot/{single|list|paged}[/state]` 与
125
125
  `{aggregate}/snapshot/count`;聚合有上下文别名、owner 或租户路径时,路由前面还要加上它们。
126
126
 
127
+ 一次请求由 `url` 与 Fetcher 决定:有名字的 Fetcher 按名字区分,无名的按 `baseURL` 区分。
128
+ 两个 `baseURL` 相同的无名 Fetcher 即使拦截器不同(例如按租户各建一个),也被视为同一个端点,
129
+ 在它们之间切换不会重新查询。给每个 Fetcher 起名,或者传已注册 Fetcher 的名字,才能区分它们。
130
+
127
131
  ## 流式读取列表
128
132
 
129
133
  `useListStreamQuery` 与 `useFetcherListStreamQuery` 以服务端推送事件(SSE)读取列表,
@@ -185,7 +189,8 @@ export function PaidOrderFeed() {
185
189
 
186
190
  请求失败和 `abort()` 都保留上一次的 `result`,刷新失败不会让界面变空白;`reset()`
187
191
  会中止进行中的请求,并清空 `result` 与 `error`。挂载即执行的 hook 首帧(服务端也一样)
188
- 就是 `loading`。
192
+ 就是 `loading`,服务端渲染时不发请求。没有 `initialResult` 选项:服务端渲染出的 HTML
193
+ 是加载状态,页面水合之后才执行查询。
189
194
 
190
195
  每个 hook 都返回 `status`、`loading`、`result`(流式 hook 为 `items` 与 `done`)、
191
196
  `error`、`execute`、`abort`、`reset`、`getQuery` 和 `setQuery`。各 hook 的选项与返回
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahoo-wang/wow-react",
3
- "version": "9.8.0",
3
+ "version": "9.9.0",
4
4
  "description": "React hooks for Wow (https://github.com/Ahoo-Wang/Wow) queries: single, list, paged, count and list-stream. Requires React 19.3 or later.",
5
5
  "keywords": [
6
6
  "wow",
@@ -49,7 +49,7 @@
49
49
  "peerDependencies": {
50
50
  "@ahoo-wang/fetcher": "^5.1.5 || ^6.0.0",
51
51
  "react": "^19.0.0",
52
- "@ahoo-wang/wow-client": "~9.8.0"
52
+ "@ahoo-wang/wow-client": "~9.9.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@ahoo-wang/fetcher": "^6.0.1",
@@ -73,7 +73,7 @@
73
73
  "unplugin-dts": "1.1.2",
74
74
  "vite": "8.3.4",
75
75
  "vitest": "^4.1.11",
76
- "@ahoo-wang/wow-client": "~9.8.0"
76
+ "@ahoo-wang/wow-client": "~9.9.0"
77
77
  },
78
78
  "scripts": {
79
79
  "build": "vite build && pnpm test:package",