-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cache): rename the cache interface name (#1224)
# Overview close #1218 - rename CacheStore to Cache, to , useCache to useRead, CacheStoreProvider to CacheProvider <!-- A clear and concise description of what this pr is about. --> ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests. --------- Co-authored-by: Jonghyeon Ko <[email protected]>
- Loading branch information
1 parent
4409299
commit c077fc5
Showing
21 changed files
with
213 additions
and
208 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@suspensive/cache': minor | ||
--- | ||
|
||
fix(cache): rename the cache interface name |
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
12 changes: 6 additions & 6 deletions
12
examples/visualization/src/app/cache/SuspenseCache/page.tsx
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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
'use client' | ||
|
||
import { CacheStore, CacheStoreProvider } from '@suspensive/cache' | ||
import { Cache, CacheProvider } from '@suspensive/cache' | ||
import { DefaultProps, DefaultPropsProvider } from '@suspensive/react' | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools' | ||
import { type PropsWithChildren, useState } from 'react' | ||
import { Spinner } from '~/components/uis' | ||
|
||
export const Providers = ({ children }: PropsWithChildren) => { | ||
const cacheStore = useState(() => new CacheStore())[0] | ||
const cache = useState(() => new Cache())[0] | ||
const queryClient = useState(() => new QueryClient({ defaultOptions: { queries: { retry: 0 } } }))[0] | ||
const defaultProps = useState(() => new DefaultProps({ Delay: { ms: 1200 }, Suspense: { fallback: <Spinner /> } }))[0] | ||
|
||
return ( | ||
<CacheStoreProvider store={cacheStore}> | ||
<CacheProvider cache={cache}> | ||
<DefaultPropsProvider defaultProps={defaultProps}> | ||
<QueryClientProvider client={queryClient}> | ||
{children} | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
</QueryClientProvider> | ||
</DefaultPropsProvider> | ||
</CacheStoreProvider> | ||
</CacheProvider> | ||
) | ||
} |
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 was deleted.
Oops, something went wrong.
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,12 @@ | ||
import { type PropsWithChildren } from 'react' | ||
import type { Cache } from './Cache' | ||
import { CacheContext } from './contexts' | ||
|
||
type CacheProviderProps = PropsWithChildren<{ cache: Cache }> | ||
|
||
/** | ||
* @experimental This is experimental feature. | ||
*/ | ||
export function CacheProvider({ cache, children }: CacheProviderProps) { | ||
return <CacheContext.Provider value={cache}>{children}</CacheContext.Provider> | ||
} |
Oops, something went wrong.