@devries-cameron20 / t3code Mirror · read-only / commits / 36f4314ab7
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 15:15 UTC

fix(web): animate command palette when closing (#5169)

Taras committed Aug 19, 2026 at 08:53 UTC 36f4314ab768dca3fc20af6ac25e7011b4b0447f
3 files changed +7 -15
apps/web/src/components/CommandPalette.logic.test.ts
+3 -3
@@ -59,7 +59,7 @@ describe("reduceCommandPaletteUiState", () => {
59
60 expect(
61 reduceCommandPaletteUiState(contentOpen, { _tag: "ToggleMode", mode: "content" }),
62 - ).toEqual({ open: false, mode: "command", openIntent: null });
62 + ).toEqual({ open: false, mode: "content", openIntent: null });
63 });
64
65 it("switches between open modes without closing", () => {
@@ -93,7 +93,7 @@ describe("reduceCommandPaletteUiState", () => {
93 });
94 });
95
96 - it("resets to command mode for dialog-driven opens and closes", () => {
96 + it("preserves the mode on close and resets it on open", () => {
97 const filesOpen = reduceCommandPaletteUiState(closedState, {
98 _tag: "ToggleMode",
99 mode: "files",
@@ -101,7 +101,7 @@ describe("reduceCommandPaletteUiState", () => {
101
102 expect(reduceCommandPaletteUiState(filesOpen, { _tag: "SetOpen", open: false })).toEqual({
103 open: false,
104 - mode: "command",
104 + mode: "files",
105 openIntent: null,
106 });
107 expect(reduceCommandPaletteUiState(filesOpen, { _tag: "SetOpen", open: true })).toEqual({
apps/web/src/components/CommandPalette.logic.ts
+4 -6
@@ -60,14 +60,12 @@ export function reduceCommandPaletteUiState(
60 ): CommandPaletteUiState {
61 switch (action._tag) {
62 case "SetOpen":
63 - return {
64 - open: action.open,
65 - mode: "command",
66 - openIntent: action.open ? state.openIntent : null,
67 - };
63 + return action.open
64 + ? { open: true, mode: "command", openIntent: state.openIntent }
65 + : { ...state, open: false, openIntent: null };
66 case "ToggleMode":
67 return state.open && state.mode === action.mode
70 - ? { open: false, mode: "command", openIntent: null }
68 + ? { ...state, open: false, openIntent: null }
69 : { open: true, mode: action.mode, openIntent: null };
70 case "OpenAddProject":
71 return { open: true, mode: "command", openIntent: { kind: "add-project" } };
apps/web/src/components/CommandPalette.tsx
-6
@@ -501,7 +501,6 @@ export function CommandPalette({ children }: { children: ReactNode }) {
501 >
502 {children}
503 <CommandPaletteDialog
504 - open={state.open}
504 mode={state.mode}
505 openIntent={state.openIntent}
506 setOpen={setOpen}
@@ -514,7 +513,6 @@ export function CommandPalette({ children }: { children: ReactNode }) {
513 }
514
515 function CommandPaletteDialog(props: {
517 - readonly open: boolean;
516 readonly mode: SearchOverlayMode;
517 readonly openIntent: CommandPaletteOpenIntent | null;
518 readonly setOpen: (open: boolean) => void;
@@ -523,10 +521,6 @@ function CommandPaletteDialog(props: {
521 }) {
522 const composerHandleRef = useComposerHandleContext();
523
526 - if (!props.open) {
527 - return null;
528 - }
529 -
524 return (
525 <CommandDialogPopup
526 aria-label={