Skip to content

Commit

Permalink
update jotai
Browse files Browse the repository at this point in the history
  • Loading branch information
David Maskasky committed Sep 25, 2024
1 parent 66164b3 commit 705669f
Show file tree
Hide file tree
Showing 36 changed files with 20 additions and 2,691 deletions.
12 changes: 6 additions & 6 deletions __tests__/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { fireEvent } from '@testing-library/react'
import { Store } from 'src/ScopeProvider/types'
import { INTERNAL_DevStoreRev4, INTERNAL_PrdStore } from 'jotai/vanilla/store'

function getElements(container: HTMLElement, querySelectors: string[]): Element[] {
return querySelectors.map((querySelector) => {
Expand All @@ -24,24 +23,25 @@ export function clickButton(container: HTMLElement, querySelector: string) {
fireEvent.click(button)
}

export function getDevStore(store: Store): INTERNAL_PrdStore & INTERNAL_DevStoreRev4 {
export type PrdStore = Exclude<Store, { dev4_get_internal_weak_map: any }>
export type DevStoreRev4 = Omit<Extract<Store, { dev4_get_internal_weak_map: any }>, keyof PrdStore>

export function getDevStore(store: Store): PrdStore & DevStoreRev4 {
if (!isDevStore(store)) {
throw new Error('Store is not a dev store')
}
return store
}

export function isDevStore(store: Store): store is INTERNAL_PrdStore & INTERNAL_DevStoreRev4 {
export function isDevStore(store: Store): store is PrdStore & DevStoreRev4 {
return (
'dev4_get_internal_weak_map' in store &&
'dev4_get_mounted_atoms' in store &&
'dev4_restore_atoms' in store
)
}

export function assertIsDevStore(
store: Store,
): asserts store is INTERNAL_PrdStore & INTERNAL_DevStoreRev4 {
export function assertIsDevStore(store: Store): asserts store is PrdStore & DevStoreRev4 {
if (!isDevStore(store)) {
throw new Error('Store is not a dev store')
}
Expand Down
2 changes: 0 additions & 2 deletions jotai/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion jotai/mode.ts

This file was deleted.

4 changes: 0 additions & 4 deletions jotai/react.ts

This file was deleted.

39 changes: 0 additions & 39 deletions jotai/react/Provider.ts

This file was deleted.

56 changes: 0 additions & 56 deletions jotai/react/useAtom.ts

This file was deleted.

168 changes: 0 additions & 168 deletions jotai/react/useAtomValue.ts

This file was deleted.

42 changes: 0 additions & 42 deletions jotai/react/useSetAtom.ts

This file was deleted.

4 changes: 0 additions & 4 deletions jotai/react/utils.ts

This file was deleted.

17 changes: 0 additions & 17 deletions jotai/react/utils/useAtomCallback.ts

This file was deleted.

Loading

0 comments on commit 705669f

Please sign in to comment.