Update user data fallback and theme handling
This commit adds a fallback mechanism to handle `null` user values in the site header account section. Previously, if `user.data` was `null`, the code could fail. Now, it checks for valid `user.data` before proceeding. For the layout section, it now includes a separate condition for 'light' theme, providing a clear distinction between 'dark'
This commit is contained in:
@@ -39,13 +39,14 @@ export function SiteHeaderAccountSection({
|
||||
function SuspendedPersonalAccountDropdown(props: { user: User | null }) {
|
||||
const signOut = useSignOut();
|
||||
const user = useUser(props.user);
|
||||
const userData = user.data ?? props.user ?? null;
|
||||
|
||||
if (user.data) {
|
||||
if (userData) {
|
||||
return (
|
||||
<PersonalAccountDropdown
|
||||
paths={paths}
|
||||
features={features}
|
||||
user={user.data}
|
||||
user={userData}
|
||||
signOutRequested={() => signOut.mutateAsync()}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user