fix: wrap layout
This commit is contained in:
@@ -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}
|
||||||
|
|||||||
Reference in New Issue
Block a user