File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ The problem is that orchestrating a single fetch for all rendered user details c
21
21
First lets setup a batcher using [ @yornaath/batshit ] ( https://www.npmjs.com/package/@yornaath/batshit )
22
22
23
23
``` ts
24
- import { Batcher , windowScheduler , keyResolver } from " @yornaath/batshit"
24
+ import { create , windowScheduler , keyResolver } from " @yornaath/batshit"
25
25
26
26
type User = { id: number , name: string }
27
27
28
- const users = Batcher <User , number >({
28
+ const users = create <User [] , number >({
29
29
// The fetcher resolves the list of queries(here just a list of user ids as number) to one single api call.
30
30
fetcher : async (ids : number []) => {
31
31
return api .users .where ({
@@ -72,4 +72,4 @@ const UserDetails = (props: {userId: number}) => {
72
72
### batshit docs
73
73
74
74
For more information about how to create batchers with custom resolving and request scheduling please refer to the batshit repo readme
75
- over at the [ yornaath/batshit github repository] ( https://github.com/yornaath/batshit/ )
75
+ over at the [ yornaath/batshit github repository] ( https://github.com/yornaath/batshit/ )
You can’t perform that action at this time.
0 commit comments