-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from psteinroe/fix/do-not-revalidate-on-mutate
fix/do not revalidate on mutate
- Loading branch information
Showing
13 changed files
with
71 additions
and
20 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 @@ | ||
--- | ||
"@supabase-cache-helpers/postgrest-swr": patch | ||
--- | ||
|
||
fix: do not revalidate on mutate by default |
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,29 @@ | ||
import { Callout, Tabs, Tab } from "nextra-theme-docs"; | ||
import Link from "next/link"; | ||
|
||
# Configuration | ||
|
||
Supabase Cache Helpers does a decent job at keeping your data up-to-date. This allows you to deviate from the standard configuration and reduce the number of requests to your backend while keeping your app fresh. | ||
|
||
<Tabs items={['SWR', 'React Query']}> | ||
<Tab> | ||
```tsx | ||
function Page() { | ||
return ( | ||
<SWRConfig | ||
value={{ | ||
revalidateIfStale: false, | ||
revalidateOnFocus: false, | ||
> | ||
... | ||
</SWRConfig> | ||
) | ||
} | ||
``` | ||
</Tab> | ||
<Tab> | ||
```tsx | ||
// TODO | ||
``` | ||
</Tab> | ||
</Tabs> |
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,17 +1,21 @@ | ||
import { render } from '@testing-library/react'; | ||
import * as dotenv from 'dotenv'; | ||
import { resolve } from 'node:path'; | ||
import React from 'react'; | ||
import { SWRConfig } from 'swr'; | ||
import { resolve } from 'node:path'; | ||
|
||
import * as dotenv from 'dotenv'; | ||
dotenv.config({ path: resolve(__dirname, '../../../.env.local') }); | ||
|
||
export const renderWithConfig = ( | ||
element: React.ReactElement, | ||
config: Parameters<typeof SWRConfig>[0]['value'] | ||
): ReturnType<typeof render> => { | ||
const TestSWRConfig = ({ children }: { children: React.ReactNode }) => ( | ||
<SWRConfig value={config}>{children}</SWRConfig> | ||
<SWRConfig | ||
value={{ revalidateOnFocus: false, revalidateIfStale: false, ...config }} | ||
> | ||
{children} | ||
</SWRConfig> | ||
); | ||
return render(element, { wrapper: TestSWRConfig }); | ||
}; |
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
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
bb2a667
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
supabase-cache-helpers – ./docs
supabase-cache-helpers-git-main-psteinroe.vercel.app
supabase-cache-helpers-psteinroe.vercel.app
supabase-cache-helpers.vercel.app
bb2a667
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
supabase-cache-helpers-swr-demo – ./examples/swr
supabase-cache-helpers-swr-demo-git-main-psteinroe.vercel.app
supabase-cache-helpers-swr-demo-psteinroe.vercel.app
supabase-cache-helpers-swr.vercel.app
bb2a667
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
supabase-cache-helpers-react-query – ./examples/react-query
supabase-cache-helpers-react-query-git-main-psteinroe.vercel.app
supabase-cache-helpers-react-query-psteinroe.vercel.app
supabase-cache-helpers-react-query.vercel.app