History

Simplify env mode change handler in ChatView

- Remove unnecessary `useCallback` wrapping from `onEnvModeChange` - Keep env mode update and composer refocus behavior unchanged

Julius Marminge committed 9 months ago

Commit 4d2f16b1 parent c6047681 file · +4 −7Browse files

Showing the changes to apps/web/src (1 of 1 file). Show all

Unified · Split

apps/web/src/components/ChatView.tsx+4−7
@@ -825,13 +825,10 @@ export default function ChatView() { · 824 unmodified lines
825 setSelectedEffort(effort);825 setSelectedEffort(effort);
826 scheduleComposerFocus();826 scheduleComposerFocus();
827 };827 };
828 const onEnvModeChange = useCallback(828 const onEnvModeChange = (mode: "local" | "worktree") => {
829 (mode: "local" | "worktree") => {829 setEnvMode(mode);
830 setEnvMode(mode);830 scheduleComposerFocus();
831 scheduleComposerFocus();831 };
832 },
833 [scheduleComposerFocus],
834 );
835 832
836 const onKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {833 const onKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
837 if (e.key === "Enter" && !e.shiftKey) {834 if (e.key === "Enter" && !e.shiftKey) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t