mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 12:59:14 +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 { Avatar, Box } from "@mui/material";
|
||||||
import UiChatWidget from "hexabot-chat-widget/src/UiChatWidget";
|
import UiChatWidget from "hexabot-chat-widget/src/UiChatWidget";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
|
||||||
import { getAvatarSrc } from "@/components/inbox/helpers/mapMessages";
|
import { getAvatarSrc } from "@/components/inbox/helpers/mapMessages";
|
||||||
import { useLoadSettings } from "@/hooks/entities/auth-hooks";
|
import { useLoadSettings } from "@/hooks/entities/auth-hooks";
|
||||||
@ -25,9 +26,14 @@ export const ChatWidget = () => {
|
|||||||
const { isAuthenticated } = useAuth();
|
const { isAuthenticated } = useAuth();
|
||||||
const isVisualEditor = pathname === `/${RouterType.VISUAL_EDITOR}`;
|
const isVisualEditor = pathname === `/${RouterType.VISUAL_EDITOR}`;
|
||||||
const { data: settings } = useLoadSettings();
|
const { data: settings } = useLoadSettings();
|
||||||
const key = JSON.stringify(
|
const key = useMemo(
|
||||||
settings?.["console_channel"]?.find((s) => s.label === "allowed_domains")
|
() =>
|
||||||
?.value,
|
JSON.stringify(
|
||||||
|
settings?.["console_channel"]?.find(
|
||||||
|
(s) => s.label === "allowed_domains",
|
||||||
|
)?.value,
|
||||||
|
),
|
||||||
|
[settings],
|
||||||
);
|
);
|
||||||
|
|
||||||
return isAuthenticated ? (
|
return isAuthenticated ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user