Update Next.js version and improve session handling
Next.js version has been upgraded from 14.2.0-canary.58 to 14.2.0-canary.60 for performance and stability improvements. Additionally, account session handling has been improved by fetching the session data during server-side processing and passing it to various components, thus optimizing the user experience.
This commit is contained in:
@@ -3,16 +3,20 @@ import { cache } from 'react';
|
||||
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
||||
|
||||
export const loadUserWorkspace = cache(async () => {
|
||||
const accounts = await loadUserAccounts();
|
||||
const client = getSupabaseServerComponentClient();
|
||||
|
||||
const accounts = await loadUserAccounts(client);
|
||||
const { data } = await client.auth.getSession();
|
||||
|
||||
return {
|
||||
accounts,
|
||||
session: data.session,
|
||||
};
|
||||
});
|
||||
|
||||
async function loadUserAccounts() {
|
||||
const client = getSupabaseServerComponentClient();
|
||||
|
||||
async function loadUserAccounts(
|
||||
client: ReturnType<typeof getSupabaseServerComponentClient>,
|
||||
) {
|
||||
const { data: accounts, error } = await client
|
||||
.from('user_accounts')
|
||||
.select(`name, slug, picture_url`);
|
||||
|
||||
Reference in New Issue
Block a user