Skip to content

Commit

Permalink
fix: fix the tab close lose focus
Browse files Browse the repository at this point in the history
  • Loading branch information
invisal committed Apr 16, 2024
1 parent f6a44cb commit 223aeaa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 0 additions & 4 deletions gui/src/components/query-result-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ export default function ResultTable({
const { openBlockEditor } = useBlockEditor();
const { databaseDriver } = useDatabaseDriver();

console.log("henlooooo");

const renderHeader = useCallback(
(header: OptimizeTableHeaderWithIndexProps) => {
return (
Expand Down Expand Up @@ -477,8 +475,6 @@ export default function ResultTable({
[copyCallback, pasteCallback]
);

console.log("Herer");

return (
<OptimizeTable
internalState={data}
Expand Down
5 changes: 4 additions & 1 deletion gui/src/components/sortable-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export const WindowTabItemButton = forwardRef<
>
<LucideX
className={cn("w-3 h-3 grow-0 shrink-0", "libsql-window-close")}
onClick={onClose}
onClick={(e) => {
e.stopPropagation();
if (onClose) onClose();
}}
/>
</div>
</button>
Expand Down
8 changes: 7 additions & 1 deletion gui/src/components/windows-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ export default function WindowTabs({
onSelectChange(idx);
}}
onClose={() => {
onTabsChange(tabs.filter((t) => t.key !== tab.key));
const newTabs = tabs.filter((t) => t.key !== tab.key);

if (selected >= idx) {
onSelectChange(newTabs.length - 1);
}

onTabsChange(newTabs);
}}
/>
))}
Expand Down

0 comments on commit 223aeaa

Please sign in to comment.