Skip to content

Commit 3a1f88d

Browse files
authored
Merge pull request #513 from damien-schneider/upgrade-nextra-doc-to-v3.2
Upgrade nextra doc to v3.2
2 parents 2349efd + c97010b commit 3a1f88d

24 files changed

+1731
-1024
lines changed

docs/next.config.js

-11
This file was deleted.

docs/next.config.mjs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @type {import('next').NextConfig} */
2+
3+
import nextra from 'nextra';
4+
5+
const withNextra = nextra({
6+
theme: 'nextra-theme-docs',
7+
themeConfig: './theme.config.jsx',
8+
});
9+
10+
export default withNextra();

docs/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
"dependencies": {
1313
"@vercel/analytics": "^1.0.0",
1414
"next": "14.2.0",
15-
"nextra": "2.13.2",
16-
"nextra-theme-docs": "2.13.2",
15+
"nextra": "3.2.0",
16+
"nextra-theme-docs": "3.2.0",
1717
"react": "18.3.1",
1818
"react-dom": "18.3.1"
1919
},
2020
"devDependencies": {
21-
"autoprefixer": "^10.4.13",
22-
"typescript": "5.5.3",
2321
"@types/node": "20.14.10",
2422
"@types/react": "18.3.3",
2523
"@types/react-dom": "18.3.0",
24+
"autoprefixer": "^10.4.13",
2625
"postcss": "^8.4.14",
27-
"tailwindcss": "3.4.0"
26+
"tailwindcss": "3.4.0",
27+
"typescript": "5.6.3"
2828
}
2929
}

docs/pages/_meta.json

-8
This file was deleted.

docs/pages/_meta.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
index: {
3+
title: 'Introduction',
4+
},
5+
configuration: 'Configuration',
6+
postgrest: 'PostgREST',
7+
storage: 'Storage',
8+
};

docs/pages/configuration.mdx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { Callout, Tabs, Tab } from "nextra-theme-docs";
2-
import Link from "next/link";
1+
import { Callout, Tabs } from 'nextra/components';
32

43
# Configuration
54

65
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.
76

87
<Tabs items={['SWR', 'React Query']}>
9-
<Tab>
8+
<Tabs.Tab>
109
```tsx
1110
function Page() {
1211
return (
@@ -21,10 +20,10 @@ Supabase Cache Helpers does a decent job at keeping your data up-to-date. This a
2120
)
2221
}
2322
```
24-
</Tab>
25-
<Tab>
23+
</Tabs.Tab>
24+
<Tabs.Tab>
2625
```tsx
2726
// TODO
2827
```
29-
</Tab>
28+
</Tabs.Tab>
3029
</Tabs>

docs/pages/index.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Callout } from "nextra-theme-docs";
1+
import { Callout } from 'nextra/components'
22

33
# Supabase Cache Helpers
44

docs/pages/postgrest/_meta.json

-8
This file was deleted.

docs/pages/postgrest/_meta.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
'getting-started': 'Getting Started',
3+
queries: 'Queries',
4+
mutations: 'Mutations',
5+
subscriptions: 'Subscriptions',
6+
'custom-cache-updates': 'Custom Cache Updates',
7+
ssr: 'Server Side Rendering',
8+
};

docs/pages/postgrest/custom-cache-updates.mdx

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Callout, Tabs, Tab } from "nextra-theme-docs";
2-
import Link from "next/link";
1+
import { Callout, Tabs } from 'nextra/components';
32

43
# Custom Cache Updates
54

@@ -10,7 +9,7 @@ Sometimes, you will find yourself writing custom cache updates. The library expo
109
Delete a postgrest entity from the cache. Note that you have to pass a value for all primary keys in the input.
1110

1211
<Tabs items={['SWR', 'React Query']}>
13-
<Tab>
12+
<Tabs.Tab>
1413
```tsx
1514
import { useDeleteItem } from "@supabase-cache-helpers/postgrest-swr";
1615

@@ -26,8 +25,8 @@ Delete a postgrest entity from the cache. Note that you have to pass a value for
2625
}
2726
```
2827

29-
</Tab>
30-
<Tab>
28+
</Tabs.Tab>
29+
<Tabs.Tab>
3130
```tsx
3231
import { useDeleteItem } from "@supabase-cache-helpers/postgrest-react-query";
3332

@@ -43,15 +42,15 @@ Delete a postgrest entity from the cache. Note that you have to pass a value for
4342
}
4443
```
4544

46-
</Tab>
45+
</Tabs.Tab>
4746
</Tabs>
4847

4948
## `useUpsertItem`
5049

5150
Upsert a postgrest entity into the cache. Note that you have to pass a value for all primary keys in the input.
5251

5352
<Tabs items={['SWR', 'React Query']}>
54-
<Tab>
53+
<Tabs.Tab>
5554
```tsx
5655
import { useUpsertItem } from "@supabase-cache-helpers/postgrest-swr";
5756

@@ -67,8 +66,8 @@ Upsert a postgrest entity into the cache. Note that you have to pass a value for
6766
}
6867
```
6968

70-
</Tab>
71-
<Tab>
69+
</Tabs.Tab>
70+
<Tabs.Tab>
7271
```tsx
7372
import { useUpsertItem } from "@supabase-cache-helpers/postgrest-react-query";
7473

@@ -84,5 +83,5 @@ Upsert a postgrest entity into the cache. Note that you have to pass a value for
8483
}
8584
```
8685

87-
</Tab>
86+
</Tabs.Tab>
8887
</Tabs>

docs/pages/postgrest/getting-started.mdx

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Callout, Tabs, Tab } from "nextra-theme-docs";
2-
import Link from "next/link";
1+
import { Callout, Tabs } from 'nextra/components';
32

43
# Getting Started
54

@@ -14,16 +13,16 @@ pnpm add @supabase-cache-helpers/postgrest-swr
1413
If your package manager does not install peer dependencies automatically, you will need to install them, too.
1514

1615
<Tabs items={["SWR", "React Query"]}>
17-
<Tab>`pnpm add swr react @supabase/postgrest-js`</Tab>
18-
<Tab>`pnpm add @tanstack/react-query react @supabase/postgrest-js`</Tab>
16+
<Tabs.Tab>`pnpm add swr react @supabase/postgrest-js`</Tabs.Tab>
17+
<Tabs.Tab>`pnpm add @tanstack/react-query react @supabase/postgrest-js`</Tabs.Tab>
1918
</Tabs>
2019

2120
## Quick Start
2221

2322
Import [`useQuery`](./queries#usequery) and define a simple query. The cache key is automatically created from the query. You can pass the SWR- and React Query-native options as a second argument. For pagination and infinite scroll queries, use [`useInfiniteOffsetPaginationQuery`](./queries#useinfiniteoffsetpaginationquery), [`useOffsetInfiniteScrollQuery`](./queries#useoffsetinfinitescrollquery) and [`useCursorInfiniteScrollQuery`](./queries#usecursorinfinitescrollquery).
2423

2524
<Tabs items={['SWR', 'React Query']}>
26-
<Tab>
25+
<Tabs.Tab>
2726
```tsx
2827
import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
2928

@@ -49,8 +48,8 @@ Import [`useQuery`](./queries#usequery) and define a simple query. The cache key
4948
}
5049
```
5150

52-
</Tab>
53-
<Tab>
51+
</Tabs.Tab>
52+
<Tabs.Tab>
5453
```tsx
5554
import { useQuery } from "@supabase-cache-helpers/postgrest-react-query";
5655

@@ -75,13 +74,13 @@ Import [`useQuery`](./queries#usequery) and define a simple query. The cache key
7574
}
7675
```
7776

78-
</Tab>
77+
</Tabs.Tab>
7978
</Tabs>
8079

8180
Somewhere in your app, import [`useInsertMutation`](./mutations#useinsertmutation) and define a mutation. For the automatic cache population to work, you need to pass the primary key(s) of the relation as a second argument. To return data from the mutation, pass a `.select('...')` string as the third argument. Pass `null` to skip. The fourth argument is the SWR- and React Query-native `options` object. The mutation will automatically update the query cache of the contact query defined above. Other operations are supported with [`useUpsertMutation`](./mutations#useupsertmutation), [`useUpdateMutation`](./mutations#useupdatemutation) and [`useDeleteMutation`](./mutations#usedeletemutation).
8281

8382
<Tabs items={['SWR', 'React Query']}>
84-
<Tab>
83+
<Tabs.Tab>
8584
```tsx
8685
import { useInsertMutation } from "@supabase-cache-helpers/postgrest-swr";
8786

@@ -103,8 +102,8 @@ Somewhere in your app, import [`useInsertMutation`](./mutations#useinsertmutatio
103102
}
104103
```
105104

106-
</Tab>
107-
<Tab>
105+
</Tabs.Tab>
106+
<Tabs.Tab>
108107
```tsx
109108
import { useInsertMutation } from "@supabase-cache-helpers/postgrest-react-query";
110109

@@ -126,15 +125,15 @@ Somewhere in your app, import [`useInsertMutation`](./mutations#useinsertmutatio
126125
}
127126
```
128127

129-
</Tab>
128+
</Tabs.Tab>
130129
</Tabs>
131130

132131
To subscribe to changes, import [`useSubscription`](./subscriptions#usesubscription) and define a subscription. Use any channel name, and define the subscription as you know it from the Supabase client. For the automatic cache population to work, you need to pass the primary key(s) of the relation. You can pass the SWR and React Query-native mutation options.
133132

134133
The query cache will automatically be updated when new data comes in. If you use [computed / virtual columns](https://postgrest.org/en/stable/api.html?highlight=computed%20columns#computed-virtual-columns) or relations, you can use [`useSubscriptionQuery`](./subscriptions#usesubscriptionquery) to fetch the entity from `PostgREST` before populating the cache with it.
135134

136135
<Tabs items={['SWR', 'React Query']}>
137-
<Tab>
136+
<Tabs.Tab>
138137
```tsx
139138
import { useSubscription } from "@supabase-cache-helpers/postgrest-swr";
140139

@@ -159,8 +158,8 @@ The query cache will automatically be updated when new data comes in. If you use
159158
}
160159
```
161160

162-
</Tab>
163-
<Tab>
161+
</Tabs.Tab>
162+
<Tabs.Tab>
164163
```tsx
165164
import { useSubscription } from "@supabase-cache-helpers/postgrest-react-query";
166165

@@ -185,5 +184,5 @@ The query cache will automatically be updated when new data comes in. If you use
185184
}
186185
```
187186

188-
</Tab>
187+
</Tabs.Tab>
189188
</Tabs>

0 commit comments

Comments
 (0)