Skip to content

Commit a495181

Browse files
committed
fix
1 parent 3fc725a commit a495181

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

components/components/chatInput/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function ChatInput({openWhiteboard, showAnim}: props) {
4545

4646
const [loading, setLoading] = useState<boolean>(false);
4747

48-
const { initCreateText, setInitCreateText, setInitCreate } = useContext(SettingContext);
48+
const { initCreateText, setInitCreateText, setInitCreate, initCreate } = useContext(SettingContext);
4949
useEffect(() => {
5050
inputRef.current.focus();
5151
}, [showAnim])
@@ -61,13 +61,17 @@ export default function ChatInput({openWhiteboard, showAnim}: props) {
6161
if (initCreateText) {
6262
setLoading(true);
6363
setInitCreate(true);
64-
setTimeout(() => {
65-
router.push('/editor', { scroll: false });
66-
}, 1000)
6764
// setLoading(false);
6865
}
6966
}
7067

68+
useEffect(() => {
69+
if (initCreate) {
70+
console.log('*************88000');
71+
router.push('/editor', { scroll: false });
72+
}
73+
}, [initCreate])
74+
7175
return (
7276
<div
7377
className="relative"

0 commit comments

Comments
 (0)