Force no cache in Supabase clients with Next.js (#27)
* Update navigation menu text color and disable caching in Supabase clients Updated the active and hover text colors for the navigation menu in the UI package. Also, added prevention of any sort of caching in the Supabase clients (server-actions.client.ts, route-handler.client.ts, server-component.client.ts) to be eventually removed in Next v15. Automatic token refresh is also turned off in the server-component client. * Increase content items limit in docs loader The content items limit in the documentation loader has been increased to the maximum safe integer. This ensures that all documentation entries are retrieved from the CMS, avoiding any potential omissions due to arbitrary limits.
This commit is contained in:
committed by
GitHub
parent
f164b24786
commit
127ad5a315
@@ -8,6 +8,7 @@ export const getDocs = cache(async (language: string | undefined) => {
|
||||
const { items: pages } = await cms.getContentItems({
|
||||
collection: 'documentation',
|
||||
language,
|
||||
limit: Number.MAX_SAFE_INTEGER,
|
||||
});
|
||||
|
||||
return pages;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'server-only';
|
||||
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
import type { CookieOptions } from '@supabase/ssr';
|
||||
@@ -24,6 +25,9 @@ export function getSupabaseRouteHandlerClient<GenericSchema = Database>(
|
||||
admin: false,
|
||||
},
|
||||
) {
|
||||
// prevent any caching (to be removed in Next v15)
|
||||
noStore();
|
||||
|
||||
if (params.admin) {
|
||||
warnServiceRoleKeyUsage();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'server-only';
|
||||
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
import { createServerClient } from '@supabase/ssr';
|
||||
@@ -25,6 +26,9 @@ function createServerSupabaseClient<
|
||||
export function getSupabaseServerActionClient<
|
||||
GenericSchema extends Database = Database,
|
||||
>(params?: { admin: boolean }) {
|
||||
// prevent any caching (to be removed in Next v15)
|
||||
noStore();
|
||||
|
||||
const keys = getSupabaseClientKeys();
|
||||
const admin = params?.admin ?? false;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'server-only';
|
||||
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
import { createServerClient } from '@supabase/ssr';
|
||||
@@ -23,12 +24,16 @@ export function getSupabaseServerComponentClient<GenericSchema = Database>(
|
||||
admin: false,
|
||||
},
|
||||
) {
|
||||
// prevent any caching (to be removed in Next v15)
|
||||
noStore();
|
||||
|
||||
if (params.admin) {
|
||||
warnServiceRoleKeyUsage();
|
||||
|
||||
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||
auth: {
|
||||
persistSession: false,
|
||||
autoRefreshToken: false,
|
||||
},
|
||||
cookies: {},
|
||||
});
|
||||
|
||||
@@ -38,8 +38,9 @@ export function BorderedNavigationMenuItem(props: {
|
||||
<Link
|
||||
href={props.path}
|
||||
className={cn('text-sm', {
|
||||
'text-primary': active,
|
||||
'text-primary/80 hover:text-primary': !active,
|
||||
'text-secondary-foreground': active,
|
||||
'text-secondary-foreground/80 hover:text-secondary-foreground':
|
||||
!active,
|
||||
})}
|
||||
>
|
||||
<Trans i18nKey={props.label} defaults={props.label} />
|
||||
|
||||
Reference in New Issue
Block a user