fix: wrap layout

This commit is contained in:
amel
2024-09-12 15:55:45 +08:00
parent ad6bd2cbfb
commit b3f1e13d10

View File

@@ -2,13 +2,15 @@
import { useHookstate } from "@hookstate/core"; import { useHookstate } from "@hookstate/core";
import { globalRole } from "../bin/val_global"; import { globalRole } from "../bin/val_global";
import { useShallowEffect } from "@mantine/hooks"; import { useShallowEffect } from "@mantine/hooks";
import { useEffect } from "react";
export default function WrapLayout({ children, role }: { children: React.ReactNode, role: any }) { export default function WrapLayout({ children, role }: { children: React.ReactNode, role: any }) {
const roleLogin = useHookstate(globalRole) const roleLogin = useHookstate(globalRole)
useShallowEffect(() => { useEffect(() => {
roleLogin.set(role) roleLogin.set(role)
}, []) // eslint-disable-next-line react-hooks/exhaustive-deps
}, [role])
return ( return (
<> <>
{children} {children}