Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 34 additions & 15 deletions apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,19 @@ hideToc: true

</StepHikeCompact.Step>

<StepHikeCompact.Step step={4}>
<StepHikeCompact.Details title="Query Supabase data from Next.js">
<StepHikeCompact.Step step={4}>
<StepHikeCompact.Details title="Create Supabase client">

Create a new file at `app/instruments/page.tsx` and populate with the following.
Create a new file at `utils/supabase/server.ts` and populate with the following.

This will select all the rows from the `instruments` table in Supabase and render them on the page.
This creates a Supabase client, using the credentials from the `env.local` file.

</StepHikeCompact.Details>

<StepHikeCompact.Code>

<$CodeTabs>

```ts name=app/instruments/page.tsx
import { createClient } from '@/utils/supabase/server';

export default async function Instruments() {
const supabase = await createClient();
const { data: instruments } = await supabase.from("instruments").select();

return <pre>{JSON.stringify(instruments, null, 2)}</pre>
}
```

```ts name=utils/supabase/server.ts
import { createServerClient } from '@supabase/ssr'
import { cookies } from 'next/headers'
Expand Down Expand Up @@ -122,6 +111,36 @@ hideToc: true
</StepHikeCompact.Step>

<StepHikeCompact.Step step={5}>
<StepHikeCompact.Details title="Query Supabase data from Next.js">

Create a new file at `app/instruments/page.tsx` and populate with the following.

This selects all the rows from the `instruments` table in Supabase and render them on the page.

</StepHikeCompact.Details>

<StepHikeCompact.Code>

<$CodeTabs>

```ts name=app/instruments/page.tsx
import { createClient } from '@/utils/supabase/server';

export default async function Instruments() {
const supabase = await createClient();
const { data: instruments } = await supabase.from("instruments").select();

return <pre>{JSON.stringify(instruments, null, 2)}</pre>
}
```

</$CodeTabs>

</StepHikeCompact.Code>

</StepHikeCompact.Step>

<StepHikeCompact.Step step={6}>
<StepHikeCompact.Details title="Start the app">

Run the development server, go to http://localhost:3000/instruments in a browser and you should see the list of instruments.
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/data/permissions/permissions-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const usePermissionsQuery = <TData = PermissionsData>({
{
...options,
enabled: IS_PLATFORM && enabled && isLoggedIn,
staleTime: 30 * 60 * 1000,
staleTime: 5 * 60 * 1000,
}
)
}
Loading