Skip to content

Commit

Permalink
feat: (breaking) api overhaul (#45)
Browse files Browse the repository at this point in the history
* feat: atomWithQuery. make suspense consistent with tanstack. use refetch from tanstack

* arbitrary change

* final atomWithQuery

* address pnpm issues

* actually address pnpm issues

* address microbundle errors

* arbitrary change

* use v5, add atomWithMutation, atomWithSuspense with existing tests

* add atomWithInfiniteQuery with existing tests adjusted to v5 api

* add atomWithSuspenseInfiniteQuery

* refactor to baseAtom pattern

* add examples

* add atomWithMutationState

* use node v20 for codesandbox ci

* use node v18 because v20 isn't supported yet by codesandbox

* add suspense test, on reset throws suspense

* can recover from error for non-suspense queries

* mark debugPrivate true

* remove atomWithObservable, stale observer ref

* update examples

* remove QueryAtomErrorResetBoundary.tsx

* cleanup, update package.json
  • Loading branch information
kalijonn authored Dec 7, 2023
1 parent 721b0b3 commit e6f6cb7
Show file tree
Hide file tree
Showing 49 changed files with 2,362 additions and 1,886 deletions.
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"buildCommand": "compile",
"sandboxes": ["new", "react-typescript-react-ts"],
"node": "14"
"node": "18"
}
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/dist
/src/vendor
/src/vendor
4 changes: 1 addition & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@
},
"alias": {
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json"],
"map": [
["^jotai-tanstack-query$", "./src/index.ts"]
]
"map": [["^jotai-tanstack-query$", "./src/index.ts"]]
}
}
},
Expand Down
20 changes: 12 additions & 8 deletions __tests__/01_basic_spec.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import {
atomsWithInfiniteQuery,
atomsWithMutation,
atomsWithQuery,
atomsWithQueryAsync,
atomWithInfiniteQuery,
atomWithMutation,
atomWithMutationState,
atomWithQuery,
atomWithSuspenseInfiniteQuery,
atomWithSuspenseQuery,
queryClientAtom,
} from '../src/index'

describe('basic spec', () => {
it('should export functions', () => {
expect(queryClientAtom).toBeDefined()
expect(atomsWithQuery).toBeDefined()
expect(atomsWithInfiniteQuery).toBeDefined()
expect(atomsWithMutation).toBeDefined()
expect(atomsWithQueryAsync).toBeDefined()
expect(atomWithQuery).toBeDefined()
expect(atomWithInfiniteQuery).toBeDefined()
expect(atomWithMutation).toBeDefined()
expect(atomWithSuspenseQuery).toBeDefined()
expect(atomWithSuspenseInfiniteQuery).toBeDefined()
expect(atomWithMutationState).toBeDefined()
})
})
Loading

0 comments on commit e6f6cb7

Please sign in to comment.