diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx index 82b4973..4686505 100644 --- a/src/components/SideBar.tsx +++ b/src/components/SideBar.tsx @@ -1,4 +1,4 @@ -import { createSignal, createEffect, Show, type JSX, Component } from 'solid-js'; +import { createSignal, Show, type JSX, Component } from 'solid-js'; import Cog6Tooth from 'heroicons/24/outline/cog-6-tooth.svg'; import Plus from 'heroicons/24/outline/plus.svg'; @@ -91,16 +91,13 @@ const SideBar: Component = () => { const closeForm = () => setFormOpened(false); const toggleForm = () => setFormOpened((current) => !current); - createEffect(() => { - if (formOpened() && textAreaRef != null) { - focusTextArea(); - } - }); - useHandleCommand(() => ({ commandType: 'openPostForm', handler: () => { - openForm(); + setTimeout(() => { + openForm(); + focusTextArea(); + }, 10); }, })); @@ -108,7 +105,16 @@ const SideBar: Component = () => {