Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix: prevent freeze when manually editing date cell and clicking away

t8y26081ba46f628
diff --git a/apps/desktop/src/components/grid/TemporalCellEditor.vue b/apps/desktop/src/components/grid/TemporalCellEditor.vue
index 97b1a94659..63a759f1f0 100644
--- a/apps/desktop/src/components/grid/TemporalCellEditor.vue
+++ b/apps/desktop/src/components/grid/TemporalCellEditor.vue
@@ -30,6 +30,7 @@ const emit = defineEmits<{
const open = ref(true);
const triggerRef = ref<HTMLButtonElement | null>(null);
let closeHandled = false;
+let isCommitting = false;
const hasDate = computed(() => props.kind !== "time");
const hasTime = computed(() => props.kind !== "date");
@@ -136,12 +137,16 @@ function setNow() {
}
function finishCommit() {
+ if (isCommitting) return;
closeHandled = true;
+ isCommitting = true;
emit("commit");
}
function finishCancel() {
+ if (isCommitting) return;
closeHandled = true;
+ isCommitting = true;
emit("cancel");
}
@@ -200,7 +205,7 @@ function twoDigit(value: string | number): string {
<PopoverContent align="start" side="bottom" class="w-auto gap-1.5 rounded-md p-1.5" @click.stop @keydown.stop="onKeydown" @interact-outside="onPopoverInteractOutside">
<div v-if="hasDate" class="grid grid-cols-[4.5rem_4.5rem_4.5rem] gap-1.5">
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
- <input :value="dateParts.year" data-temporal-part="year" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateDateFromInput('year', $event)" />
+ <input :value="dateParts.year" data-temporal-part="year" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @input="updateDateFromInput('year', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepDate('year', 1)">
<ChevronUp class="h-3 w-3" />
@@ -212,7 +217,7 @@ function twoDigit(value: string | number): string {
</div>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
- <input :value="twoDigit(dateParts.month)" data-temporal-part="month" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateDateFromInput('month', $event)" />
+ <input :value="twoDigit(dateParts.month)" data-temporal-part="month" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @input="updateDateFromInput('month', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepDate('month', 1)">
<ChevronUp class="h-3 w-3" />
@@ -224,7 +229,7 @@ function twoDigit(value: string | number): string {
</div>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
- <input :value="twoDigit(dateParts.day)" data-temporal-part="day" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateDateFromInput('day', $event)" />
+ <input :value="twoDigit(dateParts.day)" data-temporal-part="day" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @input="updateDateFromInput('day', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepDate('day', 1)">
<ChevronUp class="h-3 w-3" />
@@ -238,7 +243,7 @@ function twoDigit(value: string | number): string {
<div v-if="hasTime" class="grid grid-cols-[3.5rem_0.5rem_3.5rem_0.5rem_3.5rem] items-center gap-1.5">
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
- <input :value="twoDigit(timeParts.hour)" data-temporal-part="hour" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateTimeFromInput('hour', $event)" />
+ <input :value="twoDigit(timeParts.hour)" data-temporal-part="hour" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @input="updateTimeFromInput('hour', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepTime('hour', 1)">
<ChevronUp class="h-3 w-3" />
@@ -250,7 +255,7 @@ function twoDigit(value: string | number): string {
</div>
<span class="text-center text-xs text-muted-foreground">:</span>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
- <input :value="twoDigit(timeParts.minute)" data-temporal-part="minute" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateTimeFromInput('minute', $event)" />
+ <input :value="twoDigit(timeParts.minute)" data-temporal-part="minute" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @input="updateTimeFromInput('minute', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepTime('minute', 1)">
<ChevronUp class="h-3 w-3" />
@@ -262,7 +267,7 @@ function twoDigit(value: string | number): string {
</div>
<span class="text-center text-xs text-muted-foreground">:</span>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
- <input :value="twoDigit(timeParts.second)" data-temporal-part="second" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateTimeFromInput('second', $event)" />
+ <input :value="twoDigit(timeParts.second)" data-temporal-part="second" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @input="updateTimeFromInput('second', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepTime('second', 1)">
<ChevronUp class="h-3 w-3" />
diff --git a/apps/desktop/src/composables/useDataGridEditor.ts b/apps/desktop/src/composables/useDataGridEditor.ts
index 221d6ada7c..723da5529c 100644
--- a/apps/desktop/src/composables/useDataGridEditor.ts
+++ b/apps/desktop/src/composables/useDataGridEditor.ts
@@ -224,6 +224,7 @@ export function useDataGridEditor(options: UseDataGridEditorOptions) {
// --- Scroll helpers ---
let isCancelling = false;
+ let isCommitting = false;
let cancelScrollRestoreFrame = 0;
let resetScrollFrame = 0;
let resetScrollAfterResult = false;
@@ -397,12 +398,14 @@ export function useDataGridEditor(options: UseDataGridEditorOptions) {
}
function commitEdit() {
- if (isCancelling) return;
+ if (isCancelling || isCommitting) return;
if (!editingCell.value) return;
+ isCommitting = true;
const { rowId, col } = editingCell.value;
const item = getRowItem(rowId);
if (!item || item.isDeleted) {
editingCell.value = null;
+ isCommitting = false;
return;
}
@@ -413,15 +416,18 @@ export function useDataGridEditor(options: UseDataGridEditorOptions) {
newRows.value[item.newIndex][col] = newVal;
}
editingCell.value = null;
+ isCommitting = false;
return;
}
if (item.sourceIndex === undefined) {
editingCell.value = null;
+ isCommitting = false;
return;
}
if (!canEditExistingRows.value) {
editingCell.value = null;
+ isCommitting = false;
return;
}
@@ -440,6 +446,7 @@ export function useDataGridEditor(options: UseDataGridEditorOptions) {
}
dirtyRows.value = new Map(dirtyRows.value);
editingCell.value = null;
+ isCommitting = false;
}
function commitEditFromBlur() {