Skip to content

Commit

Permalink
Merge pull request #88 from lorefnon/bugfix-batch-loader-types
Browse files Browse the repository at this point in the history
Update examples and docs for loader type change
  • Loading branch information
mishushakov authored Jan 8, 2024
2 parents 8523553 + 0ae91f8 commit 45f35d4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
8 changes: 4 additions & 4 deletions examples/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ const resolvers: resolverTypes = {
},
Dog: {
owner: {
load (queries) {
return queries.map(q => new Promise(resolve => {
load(queries) {
return new Promise(resolve => {
setTimeout(() => {
resolve(owners[q.parent.name])
resolve(queries.map(q => owners[q.parent.name]))
}, 1000)
}))
})
}
}
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"docs:preview": "vitepress preview",
"build": "tsc -p tsconfig.json",
"postbuild": "typedoc --readme none --entryDocument index.md --plugin typedoc-plugin-markdown --tsconfig tsconfig.json --hideInPageTOC true --out www/api src/index.ts",
"ts:check": "tsc -p tsconfig.test.json",
"test": "ts-node examples/relay.ts"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true,
"skipLibCheck": true,
},
"include": ["src/**/*.ts", "examples/**/*.ts"],
}
8 changes: 4 additions & 4 deletions www/docs/guide/loaders.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ const resolvers: resolverTypes = {
},
Dog: {
owner: {
load (queries) {
load(queries) {
// Promise with timeout added to demonstrate caching
return queries.map(q => new Promise(resolve => {
return new Promise(resolve => {
setTimeout(() => {
resolve(owners[q.parent.name])
resolve(queries.map(q => owners[q.parent.name]))
}, 1000)
}))
})
}
}
}
Expand Down

0 comments on commit 45f35d4

Please sign in to comment.