Skip to content

Commit

Permalink
🐞 fix(Best practice):
Browse files Browse the repository at this point in the history
update react dependency
  • Loading branch information
junjiepro committed Oct 1, 2024
1 parent 06c2c58 commit a9ac611
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 137 deletions.
2 changes: 1 addition & 1 deletion src/components/device-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function DeviceOverview() {
const edittingDeviceData = edittingDevice?.data as any;
React.useEffect(() => {
form.setValue("name", edittingDeviceData?.name || "");
}, [edittingDeviceData?.name]);
}, [edittingDeviceData?.name, form]);

return (
<div className="flex-1 space-y-4 p-8 pt-6">
Expand Down
5 changes: 3 additions & 2 deletions src/components/llm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ export function LLM() {
: 2048) || 2048;
React.useEffect(() => {
if (maxSeqLen < params.maxSeqLen) setParams({ ...params, maxSeqLen });
}, [maxSeqLen]);
}, [maxSeqLen, params]);

const [scrollToBottom, setScrollToBottom] = React.useState(true);
const scrollElement = React.useRef<HTMLDivElement>(null);
React.useEffect(() => {
if (scrollToBottom)
scrollElement.current?.scrollIntoView({ behavior: "smooth" });
}, [messages]);
}, [messages, scrollToBottom]);

const updateParams = (type: keyof XpModelParams, value: number | string) => {
let val = value;
Expand Down Expand Up @@ -536,6 +536,7 @@ export function LLM() {
c.off("xp-llm-recive", f);
setChannel(undefined);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const clean = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/llm/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function MarkdownTextarea({
}
);
}
}, []);
}, [starryNight]);
React.useEffect(() => {
setText(value);
}, [value]);
Expand All @@ -79,7 +79,7 @@ function MarkdownTextarea({
onChange(text);
}, delay);
return () => clearTimeout(t);
}, [text]);
}, [delay, onChange, text]);

return (
<div className="editor-inner">
Expand Down
Loading

0 comments on commit a9ac611

Please sign in to comment.