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
2121First lets setup a batcher using [ @yornaath/batshit ] ( https://www.npmjs.com/package/@yornaath/batshit )
2222
2323``` ts
24- import { Batcher , windowScheduler , keyResolver } from " @yornaath/batshit"
24+ import { create , windowScheduler , keyResolver } from " @yornaath/batshit"
2525
2626type User = { id: number , name: string }
2727
28- const users = Batcher <User , number >({
28+ const users = create <User [] , number >({
2929 // The fetcher resolves the list of queries(here just a list of user ids as number) to one single api call.
3030 fetcher : async (ids : number []) => {
3131 return api .users .where ({
@@ -72,4 +72,4 @@ const UserDetails = (props: {userId: number}) => {
7272### batshit docs
7373
7474For 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