Making progress on rewrite. Looking into supabase cache helpers.

This commit is contained in:
2025-06-23 16:59:02 -05:00
parent 63574f0729
commit 13cf089870
21 changed files with 740 additions and 13 deletions

View File

@@ -0,0 +1,23 @@
'use client';
import { createBrowserClient } from '@supabase/ssr';
import type { Database } from '@/utils/supabase/database.types';
import type { SupabaseClient } from '@/utils/supabase/types';
import { useMemo } from 'react';
let client: SupabaseClient | undefined;
const getSupbaseClient = () => {
if (client) return client;
client = createBrowserClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
);
return client;
};
const useSupabaseClient = () => {
return useMemo(getSupbaseClient, []);
};
export { useSupabaseClient };