Skip to content

Commit

Permalink
fix(async): withStatusesAtom missing ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
artalar committed Jul 21, 2023
1 parent 3dc60dc commit a2e2e38
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/async/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {

import './index.story.test'
import './withCache.test'
import './withStatusesAtom.test'
import './mapToAsync.test'

test(`base API`, async () => {
Expand Down
6 changes: 2 additions & 4 deletions packages/async/src/withStatusesAtom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ test('withCache and withStatusesAtom', async () => {
const fetchData = reatomAsync(async (ctx, shouldTrow = false) => {
if (shouldTrow) throw new Error('withStatusesAtom test error')
}).pipe(
// withCache(),
withStatusesAtom(),
withCache(),
)
Expand All @@ -137,9 +136,8 @@ test('withCache and withStatusesAtom', async () => {

assert.is(track.calls.length, 4)
assert.equal(track.lastInput(), anotherPending)
fetchData(ctx, true)
// TODO this extra call is not correct, but it is not critical
assert.is(track.calls.length, 5)
fetchData(ctx, true).catch(() => {})
assert.is(track.calls.length, 4)
assert.equal(track.lastInput(), anotherPending)

await promise2.catch(() => {})
Expand Down
2 changes: 1 addition & 1 deletion packages/async/src/withStatusesAtom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const withStatusesAtom =
__thenReatomed(
ctx,
payload,
(ctx) =>
() =>
statusesAtom(
ctx,
memo(() => {
Expand Down

1 comment on commit a2e2e38

@vercel
Copy link

@vercel vercel bot commented on a2e2e38 Jul 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.