mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 16:34:36 +00:00
fix(app): open Changes on the populated comparison (#3636)
* fix(app): restore smart Changes comparison selection The tab migration persisted the selected comparison, pinning Changes to an empty view after checkout state changed. Keep comparison overrides ephemeral per surface and expire them when dirtiness changes, while preserving only presentation state in tabs. * chore(app): date Changes compatibility cleanup
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { changesStateSchema, defaultChangesState } from "./state";
|
||||
|
||||
describe("Changes presentation state", () => {
|
||||
it("drops the persisted mode without resetting the remaining presentation", () => {
|
||||
expect(
|
||||
changesStateSchema.parse({
|
||||
...defaultChangesState,
|
||||
mode: "base",
|
||||
baseRef: "origin/main",
|
||||
layout: "split",
|
||||
wrapLines: true,
|
||||
}),
|
||||
).toEqual({
|
||||
...defaultChangesState,
|
||||
layout: "split",
|
||||
wrapLines: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,22 +1,24 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const changesStateSchema = z.strictObject({
|
||||
mode: z.enum(["uncommitted", "base"]),
|
||||
baseRef: z.string().optional(),
|
||||
layout: z.enum(["unified", "split"]),
|
||||
wrapLines: z.boolean(),
|
||||
hideWhitespace: z.boolean(),
|
||||
treeVisible: z.boolean(),
|
||||
treeWidth: z.number().optional(),
|
||||
collapsedFilePaths: z.array(z.string()),
|
||||
collapsedFolderPaths: z.array(z.string()),
|
||||
commitsCollapsed: z.boolean(),
|
||||
});
|
||||
export const changesStateSchema = z
|
||||
.strictObject({
|
||||
// COMPAT(changesModeState): fields persisted by v0.5.0-beta.3; remove after 2026-11-21. Mode selection is ephemeral.
|
||||
mode: z.enum(["uncommitted", "base"]).optional(),
|
||||
baseRef: z.string().optional(),
|
||||
layout: z.enum(["unified", "split"]),
|
||||
wrapLines: z.boolean(),
|
||||
hideWhitespace: z.boolean(),
|
||||
treeVisible: z.boolean(),
|
||||
treeWidth: z.number().optional(),
|
||||
collapsedFilePaths: z.array(z.string()),
|
||||
collapsedFolderPaths: z.array(z.string()),
|
||||
commitsCollapsed: z.boolean(),
|
||||
})
|
||||
.transform(({ mode: _mode, baseRef: _baseRef, ...presentation }) => presentation);
|
||||
|
||||
export type ChangesState = z.infer<typeof changesStateSchema>;
|
||||
|
||||
export const defaultChangesState: ChangesState = {
|
||||
mode: "uncommitted",
|
||||
layout: "unified",
|
||||
wrapLines: false,
|
||||
hideWhitespace: false,
|
||||
|
||||
Reference in New Issue
Block a user