From 4dbff2b5450541d8d3ccf8579ccc7fd29db7f854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Santos?= Date: Thu, 5 Nov 2026 22:25:44 +0000 Subject: [PATCH 1/3] fix: close the task view when the scope changes The open task belongs to the board that it was opened from. Selecting another view, project, thread or assignee now closes it. Selecting the current scope again keeps it open. --- CHANGELOG.md | 4 ++++ src/board/sidebar.ts | 5 +++++ src/components/Shell.test.tsx | 4 ++-- src/components/Sidebar.tsx | 6 +----- src/state/store.test.ts | 18 ++++++++++++++++++ src/state/store.ts | 4 +++- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 592e005..0d2135e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Selecting another view, project, thread or assignee in the sidebar closes the task view. + ## [1.0.0] - 2026-11-03 ### Added diff --git a/src/board/sidebar.ts b/src/board/sidebar.ts index 6c5f317..52b3eb9 100644 --- a/src/board/sidebar.ts +++ b/src/board/sidebar.ts @@ -40,6 +40,11 @@ export function sidebarModel(allRows: TaskRow[], names: ProjectNames = {}): Side } /** The name the sidebar gives a scope; a project with no rows left is named by its given name or its folder. */ +/** True when both scopes name the same view, project, thread or assignee. */ +export function sameScope(a: Scope, b: Scope): boolean { + return JSON.stringify(a) === JSON.stringify(b); +} + export function scopeTitle(scope: Scope, model: SidebarModel, names: ProjectNames = {}): string { switch (scope.kind) { case "desk": diff --git a/src/components/Shell.test.tsx b/src/components/Shell.test.tsx index 81a9a84..9b4ecf6 100644 --- a/src/components/Shell.test.tsx +++ b/src/components/Shell.test.tsx @@ -870,8 +870,8 @@ describe("cursor across live changes", () => { await userEvent.keyboard("{Enter}"); await screen.findByRole("complementary", { name: "Task" }); vi.mocked(api.listScope).mockResolvedValue([row({ number: 7, status: "started" })]); - await useDeck.getState().selectScope({ kind: "all" }); - useDeck.setState({ cursor: 7 }); + await useDeck.getState().refresh(); + useDeck.setState({ cursor: 7, focus: "board" }); expect(useDeck.getState().openTask).toBe(3); await userEvent.keyboard("{Control>}d{/Control}"); await vi.waitFor(() => expect(api.setStatus).toHaveBeenCalledWith(7, { kind: "done", clean: false })); diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index e459d08..cb41e41 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -2,7 +2,7 @@ import { useEffect, useMemo, useRef, useState } from "react"; import { showPullDown } from "../api/client"; import type { Scope } from "../api/types"; import type { SidebarItem } from "../board/sidebar"; -import { sidebarModel } from "../board/sidebar"; +import { sameScope, sidebarModel } from "../board/sidebar"; import { resolveKeymap } from "../keys/keymap"; import type { Handler, Handlers } from "../keys/useKeymap"; import { useKeymap } from "../keys/useKeymap"; @@ -24,10 +24,6 @@ export const RENAME_PROJECT = "pane-rename-project"; const TITLES: Record = { projects: "Projects", threads: "Threads", assignees: "Assignees" }; -function sameScope(a: Scope, b: Scope): boolean { - return JSON.stringify(a) === JSON.stringify(b); -} - function symbolFor(scope: Scope): SymbolName { switch (scope.kind) { case "desk": diff --git a/src/state/store.test.ts b/src/state/store.test.ts index 3b129f3..c7c2a31 100644 --- a/src/state/store.test.ts +++ b/src/state/store.test.ts @@ -537,6 +537,24 @@ describe("reading the open task", () => { }); }); +describe("changing scope", () => { + it("closes the open task when another scope is selected", async () => { + useDeck.setState({ scope: { kind: "project", path: "/home/test/alpha" }, openTask: 1, detail: detail({ number: 1 }) }); + await useDeck.getState().selectScope({ kind: "project", path: "/home/test/beta" }); + const state = useDeck.getState(); + expect(state.openTask).toBeNull(); + expect(state.detail).toBeNull(); + expect(api.getTask).not.toHaveBeenCalled(); + }); + + it("keeps the open task when the current scope is selected again", async () => { + vi.mocked(api.getTask).mockResolvedValue(detail({ number: 1 })); + useDeck.setState({ scope: { kind: "project", path: "/home/test/alpha" }, openTask: 1, detail: detail({ number: 1 }) }); + await useDeck.getState().selectScope({ kind: "project", path: "/home/test/alpha" }); + expect(useDeck.getState().openTask).toBe(1); + }); +}); + describe("marks", () => { it("drops the mark of a task that leaves the board", async () => { useDeck.setState({ scope: { kind: "all" } }); diff --git a/src/state/store.ts b/src/state/store.ts index a248878..1ebdb28 100644 --- a/src/state/store.ts +++ b/src/state/store.ts @@ -18,7 +18,7 @@ import { groupChoices, sortChoices } from "../board/choices"; import { applyOptimistic } from "../board/optimistic"; import { buildBoard, liveNumbersOf } from "../board/sections"; import type { ProjectNames } from "../board/sidebar"; -import { onDesk, projectLabelsOf, sortByProject } from "../board/sidebar"; +import { onDesk, projectLabelsOf, sameScope, sortByProject } from "../board/sidebar"; import type { Change, Command, UndoEntry } from "../board/undo"; import { inverseOf } from "../board/undo"; @@ -459,6 +459,8 @@ export const useDeck = create()((set, get) => ({ }, async selectScope(scope) { + // The open task's pane belongs to the board it was opened from. + if (!sameScope(scope, get().scope)) get().close(); const current = get().options; const group = groupChoices(scope).includes(current.group) ? current.group : "none"; const sort = sortChoices(scope).includes(current.sort) ? current.sort : "recent"; From 3669915ce16e8282e3406820b6a18a6db067c988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Santos?= Date: Thu, 5 Nov 2026 22:25:53 +0000 Subject: [PATCH 2/3] docs: include keyboard view changes in the changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d2135e..37046ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Selecting another view, project, thread or assignee in the sidebar closes the task view. +- Selecting another view, project, thread or assignee closes the task view. ## [1.0.0] - 2026-11-03 From c93bb10046f3d9b4ce050ee9815a3dce9503eff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Santos?= Date: Thu, 5 Nov 2026 22:27:26 +0000 Subject: [PATCH 3/3] chore: release 1.0.1 --- CHANGELOG.md | 5 ++++- package-lock.json | 4 ++-- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37046ed..a607dbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.1] - 2026-11-05 + ### Changed - Selecting another view, project, thread or assignee closes the task view. @@ -36,5 +38,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - A content security policy for the app's windows, and an absolute path required for the `tsk` binary in Settings. -[Unreleased]: https://github.com/s3rgiosan/tskdeck/compare/1.0.0...HEAD +[Unreleased]: https://github.com/s3rgiosan/tskdeck/compare/1.0.1...HEAD +[1.0.1]: https://github.com/s3rgiosan/tskdeck/compare/1.0.0...1.0.1 [1.0.0]: https://github.com/s3rgiosan/tskdeck/releases/tag/1.0.0 diff --git a/package-lock.json b/package-lock.json index ac40e2b..7c47a52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tskdeck", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tskdeck", - "version": "1.0.0", + "version": "1.0.1", "dependencies": { "@tauri-apps/api": "^2", "@tauri-apps/plugin-dialog": "^2.8.4", diff --git a/package.json b/package.json index e97ca39..e0de6d5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tskdeck", "private": true, - "version": "1.0.0", + "version": "1.0.1", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2d74600..6b285ac 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4107,7 +4107,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tskdeck" -version = "1.0.0" +version = "1.0.1" dependencies = [ "dirs", "notify", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 53f9d15..6f93e3a 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tskdeck" -version = "1.0.0" +version = "1.0.1" description = "Unofficial desktop client for the tsk task board" authors = ["Sérgio Santos"] edition = "2024" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b5376e0..6421af1 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "tskdeck", - "version": "1.0.0", + "version": "1.0.1", "identifier": "com.s3rgiosan.tskdeck", "build": { "beforeDevCommand": "npm run dev",