|
1 | 1 | # @data-client/core
|
2 | 2 |
|
| 3 | +## 0.13.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#3105](https://github.com/reactive/data-client/pull/3105) [`cf770de`](https://github.com/reactive/data-client/commit/cf770de244ad890b286c59ac305ceb6c3b1288ea) Thanks [@ntucker](https://github.com/ntucker)! - Add controller.set() |
| 8 | + |
| 9 | + ```ts |
| 10 | + ctrl.set( |
| 11 | + Todo, |
| 12 | + { id: '5' }, |
| 13 | + { id: '5', title: 'tell me friends how great Data Client is' }, |
| 14 | + ); |
| 15 | + ``` |
| 16 | + |
| 17 | + BREAKING CHANGE: |
| 18 | + |
| 19 | + - actionTypes.SET_TYPE -> actionTypes.SET_RESPONSE_TYPE |
| 20 | + - SetAction -> SetResponseAction |
| 21 | + |
3 | 22 | ## 0.12.5
|
4 | 23 |
|
5 | 24 | ### Patch Changes
|
|
112 | 131 |
|
113 | 132 | ```tsx
|
114 | 133 | export const PostResource = createResource({
|
115 |
| - path: "/posts/:id", |
| 134 | + path: '/posts/:id', |
116 | 135 | schema: Post,
|
117 |
| - }).extend((Base) => ({ |
| 136 | + }).extend(Base => ({ |
118 | 137 | vote: new RestEndpoint({
|
119 |
| - path: "/posts/:id/vote", |
120 |
| - method: "POST", |
| 138 | + path: '/posts/:id/vote', |
| 139 | + method: 'POST', |
121 | 140 | body: undefined,
|
122 | 141 | schema: Post,
|
123 | 142 | getOptimisticResponse(snapshot, { id }) {
|
|
136 | 155 |
|
137 | 156 | ```tsx
|
138 | 157 | export const PostResource = createResource({
|
139 |
| - path: "/posts/:id", |
| 158 | + path: '/posts/:id', |
140 | 159 | schema: Post,
|
141 |
| - }).extend("vote", { |
142 |
| - path: "/posts/:id/vote", |
143 |
| - method: "POST", |
| 160 | + }).extend('vote', { |
| 161 | + path: '/posts/:id/vote', |
| 162 | + method: 'POST', |
144 | 163 | body: undefined,
|
145 | 164 | schema: Post,
|
146 | 165 | getOptimisticResponse(snapshot, { id }) {
|
|
302 | 321 |
|
303 | 322 | ```ts
|
304 | 323 | class LoggingManager implements Manager {
|
305 |
| - getMiddleware = |
306 |
| - (): Middleware => (controller) => (next) => async (action) => { |
307 |
| - console.log("before", action, controller.getState()); |
308 |
| - await next(action); |
309 |
| - console.log("after", action, controller.getState()); |
310 |
| - }; |
| 324 | + getMiddleware = (): Middleware => controller => next => async action => { |
| 325 | + console.log('before', action, controller.getState()); |
| 326 | + await next(action); |
| 327 | + console.log('after', action, controller.getState()); |
| 328 | + }; |
311 | 329 |
|
312 | 330 | cleanup() {}
|
313 | 331 | }
|
|
351 | 369 | - f95dbc64d1: [Collections](https://dataclient.io/rest/api/Collection) can filter based on FormData arguments
|
352 | 370 |
|
353 | 371 | ```ts
|
354 |
| - ctrl.fetch(getPosts.push, { group: "react" }, new FormData(e.currentTarget)); |
| 372 | + ctrl.fetch(getPosts.push, { group: 'react' }, new FormData(e.currentTarget)); |
355 | 373 | ```
|
356 | 374 |
|
357 | 375 | Say our FormData contained an `author` field. Now that newly created
|
358 | 376 | item will be properly added to the [collection list](https://dataclient.io/rest/api/Collection) for that author.
|
359 | 377 |
|
360 | 378 | ```ts
|
361 | 379 | useSuspense(getPosts, {
|
362 |
| - group: "react", |
363 |
| - author: "bob", |
| 380 | + group: 'react', |
| 381 | + author: 'bob', |
364 | 382 | });
|
365 | 383 | ```
|
366 | 384 |
|
|
0 commit comments