-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: switch to useSyncExternalStoreWithSelector (#1953)
* type: extends useConfig cache interface (#1938) * remove mount check for react18 (#1927) reactwg/react-18#82 related pr #787 #433 * lint: dont check unused vars with underscore prefix (#1939) * test: upgrade to jest 28 (#1942) * Upgrade to jest 28 * Upgrade to jest 28 * feat: useSyncExternalStoreWithSelector * refactor: remove stateUpdate and boardcast state update should be handled by uSESW * type: fix test type error * remove pnpm.lock * fix: import cjs for codesanbox * refactor: add selector * refactor: add cachestate interface and try fix custom cache * fix: custom cache init * refactor: remove useless flag * chore: codesanbox ci * refactor: remove force render in infinite * build: add _internal * chore: mark warning test * fix: dts generation * codesanbox ci * chore: rename swr folder to core Co-authored-by: Jiachi Liu <[email protected]>
- Loading branch information
Showing
56 changed files
with
1,512 additions
and
8,248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import SWRConfig from './utils/config-context' | ||
import * as revalidateEvents from './constants' | ||
|
||
export { SWRConfig, revalidateEvents } | ||
|
||
export { initCache } from './utils/cache' | ||
export { defaultConfig, cache, mutate, compare } from './utils/config' | ||
export * from './utils/env' | ||
export { SWRGlobalState } from './utils/global-state' | ||
export { stableHash } from './utils/hash' | ||
export * from './utils/helper' | ||
export { mergeConfigs } from './utils/merge-config' | ||
export { internalMutate } from './utils/mutate' | ||
export { normalize } from './utils/normalize-args' | ||
export { withArgs } from './utils/resolve-args' | ||
export { serialize } from './utils/serialize' | ||
export { useStateWithDeps } from './utils/state' | ||
export { subscribeCallback } from './utils/subscribe-key' | ||
export { getTimestamp } from './utils/timestamp' | ||
export { useSWRConfig } from './utils/use-swr-config' | ||
export { preset, defaultConfigOptions } from './utils/web-preset' | ||
export { withMiddleware } from './utils/with-middleware' | ||
|
||
export * from './types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "swr-internal", | ||
"version": "0.0.1", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.esm.js", | ||
"types": "./dist/_internal", | ||
"exports": "./dist/index.mjs", | ||
"peerDependencies": { | ||
"react": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "..", | ||
"outDir": "./dist" | ||
}, | ||
"include": ["./**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Cache, GlobalState } from '../types' | ||
|
||
// Global state used to deduplicate requests and store listeners | ||
export const SWRGlobalState = new WeakMap<Cache, GlobalState>() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.