Skip to content

Commit

Permalink
chore: fix models in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
krulod committed Feb 1, 2024
1 parent 5de8bca commit 77146c6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions examples/react-search/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const searchAtom = atom('', 'searchAtom')
export const issues = reatomResource(async (ctx) => {
const query = ctx.spy(searchAtom)
if (!query) return []
await sleep(350)
await ctx.schedule(() => sleep(350))
const { items } = await searchIssues({
query,
controller: ctx.controller,
Expand All @@ -46,7 +46,7 @@ export const issues = reatomResource(async (ctx) => {
}, 'issues').pipe(
withDataAtom([]),
withErrorAtom(),
withCache({ length: 50, swr: false, paramsLength: 1 }),
withCache({ length: 50, swr: false }),
withRetry({
onReject(ctx, error: any, retries) {
// return delay in ms or -1 to prevent retries
Expand All @@ -63,7 +63,7 @@ const searchIssues = async (config: {
}) => {
const response = await fetch(
`https://api.github.com/search/issues?q=${config.query}&page=1&per_page=10`,
config.controller,
{signal: config.controller.signal},
)
if (response.status !== 200) {
const error = new Error()
Expand Down
2 changes: 1 addition & 1 deletion examples/vue-search/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/vue-search/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const searchAtom = atom('', 'searchAtom')
export const issues = reatomResource(async (ctx) => {
const query = ctx.spy(searchAtom)
if (!query) return []
await sleep(350)
await ctx.schedule(() => sleep(350))
const { items } = await searchIssues({
query,
controller: ctx.controller,
Expand All @@ -46,7 +46,7 @@ export const issues = reatomResource(async (ctx) => {
}, 'issues').pipe(
withDataAtom([]),
withErrorAtom(),
withCache({ length: 50, swr: false, paramsLength: 1 }),
withCache({ length: 50, swr: false }),
withRetry({
onReject(ctx, error: any, retries) {
// return delay in ms or -1 to prevent retries
Expand All @@ -63,7 +63,7 @@ const searchIssues = async (config: {
}) => {
const response = await fetch(
`https://api.github.com/search/issues?q=${config.query}&page=1&per_page=10`,
config.controller,
{signal: config.controller.signal},
)
if (response.status !== 200) {
const error = new Error()
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 77146c6

Please sign in to comment.