fix: PG cell-edit serialization + recent-connections startup race (#6)
Release / windows (push) Failing after 18m10s
Release / linux (push) Successful in 19m10s

This commit was merged in pull request #6.
This commit is contained in:
2026-09-01 04:23:07 +00:00
parent 7a66b70c26
commit 7bd4e8d05f
13 changed files with 240 additions and 59 deletions
+3 -3
View File
@@ -1,11 +1,11 @@
import { describe, it, expect } from "vitest";
import tauriConf from "../../src-tauri/tauri.conf.json";
describe("tauri bundle config (v0.7.11)", () => {
describe("tauri bundle config (v0.7.12)", () => {
it("declares bundled pg_tools resources", () => {
expect(tauriConf.bundle.resources).toContain("resources/pg_tools/*");
});
it("version is 0.7.11", () => {
expect(tauriConf.version).toBe("0.7.11");
it("version is 0.7.12", () => {
expect(tauriConf.version).toBe("0.7.12");
});
});
+7 -7
View File
@@ -4,7 +4,7 @@ import { describe, it, expect } from "vitest";
import agents from "../../../AGENTS.md?raw";
import readme from "../../../README.md?raw";
describe("v0.7.11 docs coverage", () => {
describe("v0.7.12 docs coverage", () => {
it("AGENTS.md marks inline cell editing complete", () => {
expect(agents).toContain("Inline cell editing");
expect(agents).toMatch(/Inline cell editing \| ✅/);
@@ -24,8 +24,8 @@ describe("v0.7.11 docs coverage", () => {
expect(agents).toMatch(/Connection status indicator on cards \| ✅/);
expect(agents).toMatch(/Move-to-folder bulk action \| ✅/);
});
it("README declares v0.7.11", () => {
expect(readme).toContain("0.7.11");
it("README declares v0.7.12", () => {
expect(readme).toContain("0.7.12");
});
it("AGENTS.md marks schema CRUD complete", () => {
expect(agents).toMatch(/Schema CRUD \| ✅/);
@@ -64,9 +64,9 @@ describe("v0.7.11 docs coverage", () => {
expect(agents).toMatch(/Cancel long-running queries \| ✅/);
expect(agents).toMatch(/Settings export\/import \| ✅/);
});
it("README links to v0.7.11 assets in both download tables", () => {
expect(readme).toContain("releases/download/v0.7.11/");
expect(readme).toContain("Gridline_0.7.11_aarch64.dmg");
expect(readme).toContain("Gridline-0.7.11-1.x86_64.rpm");
it("README links to v0.7.12 assets in both download tables", () => {
expect(readme).toContain("releases/download/v0.7.12/");
expect(readme).toContain("Gridline_0.7.12_aarch64.dmg");
expect(readme).toContain("Gridline-0.7.12-1.x86_64.rpm");
});
});
+2 -2
View File
@@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest";
import pkg from "../../package.json";
describe("version", () => {
it("declares v0.7.11 across the app shell", () => {
expect(pkg.version).toBe("0.7.11");
it("declares v0.7.12 across the app shell", () => {
expect(pkg.version).toBe("0.7.12");
});
});
@@ -225,6 +225,33 @@ describe("favorites / recents / move-selection", () => {
expect(commands.recordRecentConnection).toHaveBeenCalledWith("c1");
});
it("loadAll refreshes recents once connections are known (startup race fix)", async () => {
const conn = makeConn({ id: "c1", name: "Prod" });
vi.spyOn(commands, "getConnections").mockResolvedValue([conn]);
vi.spyOn(commands, "getFolders").mockResolvedValue([]);
vi.spyOn(commands, "getTags").mockResolvedValue([]);
vi.spyOn(commands, "getRecentConnections").mockResolvedValue([
{ connection_id: "c1", opened_at: "2026-08-02T00:00:00Z" },
]);
// Simulate the app-shell mount: loadAll fires and populates connections.
await useConnectionStore.getState().loadAll();
// The recent strip must now show the connection that was opened previously.
expect(commands.getRecentConnections).toHaveBeenCalledWith(8);
expect(useConnectionStore.getState().recent).toEqual([conn]);
});
it("loadRecent maps cached recent ids against the current connection list", async () => {
const conn = makeConn({ id: "c1", name: "Prod" });
useConnectionStore.setState({ connections: [conn] });
vi.spyOn(commands, "getRecentConnections").mockResolvedValue([
{ connection_id: "c1", opened_at: "2026-08-02T00:00:00Z" },
]);
await useConnectionStore.getState().loadRecent();
expect(useConnectionStore.getState().recent).toEqual([conn]);
});
describe("duplicateConnection", () => {
it("copies fields with a '(copy)' name and favorite false", async () => {
const src = makeConn({ id: "c1", name: "Prod", folder_id: "f1", tag_ids: ["t1"], favorite: true });
+3
View File
@@ -46,6 +46,9 @@ export const useConnectionStore = create<ConnectionState>((set, get) => ({
set((s) => ({ connections: [...s.connections].sort((a, b) => Number(b.favorite) - Number(a.favorite)) }));
// Also load tag order
get().loadTagOrder();
// Refresh recents once connections are known so the recent strip is not
// computed against an empty list (avoids a startup race with loadRecent).
get().loadRecent().catch(() => {});
} catch (e) {
set({ loading: false, error: e instanceof Error ? e.message : String(e) });
}