mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +00:00
fix: update the logic to use useMemo
This commit is contained in:
parent
eb38675ded
commit
b8033acf4c
@ -9,6 +9,7 @@
|
||||
import { Avatar, Box } from "@mui/material";
|
||||
import UiChatWidget from "hexabot-chat-widget/src/UiChatWidget";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { getAvatarSrc } from "@/components/inbox/helpers/mapMessages";
|
||||
import { useLoadSettings } from "@/hooks/entities/auth-hooks";
|
||||
@ -25,9 +26,14 @@ export const ChatWidget = () => {
|
||||
const { isAuthenticated } = useAuth();
|
||||
const isVisualEditor = pathname === `/${RouterType.VISUAL_EDITOR}`;
|
||||
const { data: settings } = useLoadSettings();
|
||||
const key = JSON.stringify(
|
||||
settings?.["console_channel"]?.find((s) => s.label === "allowed_domains")
|
||||
?.value,
|
||||
const key = useMemo(
|
||||
() =>
|
||||
JSON.stringify(
|
||||
settings?.["console_channel"]?.find(
|
||||
(s) => s.label === "allowed_domains",
|
||||
)?.value,
|
||||
),
|
||||
[settings],
|
||||
);
|
||||
|
||||
return isAuthenticated ? (
|
||||
|
Loading…
Reference in New Issue
Block a user