|
1 | 1 | # @data-client/react
|
2 | 2 |
|
| 3 | +## 0.12.8 |
| 4 | + |
| 5 | +### Patch Changes |
| 6 | + |
| 7 | +- [#3071](https://github.com/reactive/data-client/pull/3071) [`7fba440`](https://github.com/reactive/data-client/commit/7fba44050a4e3fdcc37ab8405730b35366c293e1) Thanks [@ntucker](https://github.com/ntucker)! - React 19 JSX runtime compatibility. |
| 8 | + |
| 9 | + BREAKING CHANGE: Min React version 16.8.4 -> 16.14 |
| 10 | + |
| 11 | + 16.14 is the first version of React to include JSX runtime. |
| 12 | + |
| 13 | +- Updated dependencies [[`7fba440`](https://github.com/reactive/data-client/commit/7fba44050a4e3fdcc37ab8405730b35366c293e1)]: |
| 14 | + - @data-client/use-enhanced-reducer@0.1.8 |
| 15 | + |
3 | 16 | ## 0.12.5
|
4 | 17 |
|
5 | 18 | ### Patch Changes
|
|
59 | 72 |
|
60 | 73 | ```ts
|
61 | 74 | const getThing = new Endpoint(
|
62 |
| - (args: { postId: string | number; sortBy?: "votes" | "recent" }) => |
| 75 | + (args: { postId: string | number; sortBy?: 'votes' | 'recent' }) => |
63 | 76 | Promise.resolve({ a: 5, ...args }),
|
64 | 77 | { schema: MyEntity },
|
65 | 78 | );
|
66 | 79 |
|
67 | 80 | const myThing = useSuspense(getThing, {
|
68 |
| - postId: "5", |
69 |
| - sortBy: "votes", |
| 81 | + postId: '5', |
| 82 | + sortBy: 'votes', |
70 | 83 | });
|
71 | 84 | ```
|
72 | 85 |
|
|
186 | 199 |
|
187 | 200 | ```ts
|
188 | 201 | class User extends Entity {
|
189 |
| - username = ""; |
190 |
| - id = ""; |
191 |
| - groupId = ""; |
| 202 | + username = ''; |
| 203 | + id = ''; |
| 204 | + groupId = ''; |
192 | 205 | pk() {
|
193 | 206 | return this.id;
|
194 | 207 | }
|
195 |
| - static index = ["username" as const]; |
| 208 | + static index = ['username' as const]; |
196 | 209 | }
|
197 | 210 |
|
198 |
| - const bob = useQuery(User, { username: "bob" }); |
| 211 | + const bob = useQuery(User, { username: 'bob' }); |
199 | 212 | ```
|
200 | 213 |
|
201 | 214 | ```ts
|
202 | 215 | const getUserCount = new schema.Query(
|
203 | 216 | new schema.All(User),
|
204 | 217 | (entries, { isAdmin } = {}) => {
|
205 | 218 | if (isAdmin !== undefined)
|
206 |
| - return entries.filter((user) => user.isAdmin === isAdmin).length; |
| 219 | + return entries.filter(user => user.isAdmin === isAdmin).length; |
207 | 220 | return entries.length;
|
208 | 221 | },
|
209 | 222 | );
|
|
219 | 232 | }),
|
220 | 233 | });
|
221 | 234 |
|
222 |
| - const usersInGroup = useQuery(UserCollection, { groupId: "5" }); |
| 235 | + const usersInGroup = useQuery(UserCollection, { groupId: '5' }); |
223 | 236 | ```
|
224 | 237 |
|
225 | 238 | - [#2921](https://github.com/reactive/data-client/pull/2921) [`6e55026`](https://github.com/reactive/data-client/commit/6e550260672507592d75c4781dc2563a50e664fa) Thanks [@ntucker](https://github.com/ntucker)! - Add [controller.get](https://dataclient.io/docs/api/Controller#get) / [snapshot.get](https://dataclient.io/docs/api/Snapshot#get) to directly read [Querable Schemas](https://dataclient.io/docs/api/useQuery#queryable)
|
|
228 | 241 |
|
229 | 242 | ```tsx
|
230 | 243 | export const PostResource = createResource({
|
231 |
| - path: "/posts/:id", |
| 244 | + path: '/posts/:id', |
232 | 245 | schema: Post,
|
233 |
| - }).extend((Base) => ({ |
| 246 | + }).extend(Base => ({ |
234 | 247 | vote: new RestEndpoint({
|
235 |
| - path: "/posts/:id/vote", |
236 |
| - method: "POST", |
| 248 | + path: '/posts/:id/vote', |
| 249 | + method: 'POST', |
237 | 250 | body: undefined,
|
238 | 251 | schema: Post,
|
239 | 252 | getOptimisticResponse(snapshot, { id }) {
|
|
252 | 265 |
|
253 | 266 | ```tsx
|
254 | 267 | export const PostResource = createResource({
|
255 |
| - path: "/posts/:id", |
| 268 | + path: '/posts/:id', |
256 | 269 | schema: Post,
|
257 |
| - }).extend("vote", { |
258 |
| - path: "/posts/:id/vote", |
259 |
| - method: "POST", |
| 270 | + }).extend('vote', { |
| 271 | + path: '/posts/:id/vote', |
| 272 | + method: 'POST', |
260 | 273 | body: undefined,
|
261 | 274 | schema: Post,
|
262 | 275 | getOptimisticResponse(snapshot, { id }) {
|
|
462 | 475 | Current testing version is already [using the provider Component directly](https://dataclient.io/docs/api/makeRenderDataClient)
|
463 | 476 |
|
464 | 477 | ```tsx
|
465 |
| - import { CacheProvider } from "@data-client/react"; |
| 478 | + import { CacheProvider } from '@data-client/react'; |
466 | 479 | const renderDataClient = makeRenderDataClient(CacheProvider);
|
467 | 480 | ```
|
468 | 481 |
|
|
517 | 530 | pk(): string {
|
518 | 531 | return `${this.trade_id}`;
|
519 | 532 | }
|
520 |
| - static key = "Ticker"; |
| 533 | + static key = 'Ticker'; |
521 | 534 |
|
522 | 535 | static schema = {
|
523 | 536 | price: Number,
|
|
537 | 550 | pk(): string {
|
538 | 551 | return `${this.trade_id}`;
|
539 | 552 | }
|
540 |
| - static key = "Ticker"; |
| 553 | + static key = 'Ticker'; |
541 | 554 |
|
542 | 555 | static schema = {
|
543 | 556 | price: Number,
|
|
564 | 577 | - f95dbc64d1: [Collections](https://dataclient.io/rest/api/Collection) can filter based on FormData arguments
|
565 | 578 |
|
566 | 579 | ```ts
|
567 |
| - ctrl.fetch(getPosts.push, { group: "react" }, new FormData(e.currentTarget)); |
| 580 | + ctrl.fetch(getPosts.push, { group: 'react' }, new FormData(e.currentTarget)); |
568 | 581 | ```
|
569 | 582 |
|
570 | 583 | Say our FormData contained an `author` field. Now that newly created
|
571 | 584 | item will be properly added to the [collection list](https://dataclient.io/rest/api/Collection) for that author.
|
572 | 585 |
|
573 | 586 | ```ts
|
574 | 587 | useSuspense(getPosts, {
|
575 |
| - group: "react", |
576 |
| - author: "bob", |
| 588 | + group: 'react', |
| 589 | + author: 'bob', |
577 | 590 | });
|
578 | 591 | ```
|
579 | 592 |
|
|
0 commit comments