fix(core): display user name dynamically (#4248)

This commit is contained in:
Alex Yang
2023-09-06 22:02:21 -07:00
committed by GitHub
parent 4d96d2dd02
commit 57c5f6cd2c
4 changed files with 56 additions and 9 deletions

View File

@@ -16,7 +16,6 @@ import {
getCurrentStore,
} from '@toeverything/infra/atom';
import { useAtomValue, useSetAtom } from 'jotai';
import { getSession } from 'next-auth/react';
import { type ReactElement, useCallback } from 'react';
import type { LoaderFunction } from 'react-router-dom';
import { redirect } from 'react-router-dom';
@@ -139,11 +138,6 @@ export const loader: LoaderFunction = async args => {
} else {
return redirect('/404');
}
const session = await getSession();
const name = session?.user.name;
currentWorkspace.awarenessStore.awareness.setLocalStateField('user', {
name: name ?? 'Anonymous User',
});
return null;
};