fix(tasks): a task opened by a link does not open again on every return to the tab
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m40s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-11-01 18:18:56 +01:00
1 parent 687389df64
commit 2bb0dec744
6 files changed
+19 -5

No files matched your search

@@ -65,6 +65,9 @@ interface TasksViewProps {
onOpenDocument: (docId: string, blockId?: string) => void;
refreshTrigger?: number;
initialSelectedTaskId?: string | null;
// The task from initialSelectedTaskId was opened; the parent forgets it, so returning to the tab does
// not open it again
onInitialTaskShown?: () => void;
openTasksCount?: number; // all open tasks incl. shared lists (same as the nav bar counter)
}
@@ -94,6 +97,7 @@ export const TasksView: React.FC<TasksViewProps> = ({
onOpenDocument,
refreshTrigger = 0,
initialSelectedTaskId,
onInitialTaskShown,
openTasksCount,
}) => {
// Open list and view survive switching to other tabs (like the workspace's open note)
@@ -177,11 +181,14 @@ export const TasksView: React.FC<TasksViewProps> = ({
const [showDetailModal, setShowDetailModal] = useState(false);
const [extraTask, setExtraTask] = useState<Thought | null>(null);
const onInitialTaskShownRef = useRef(onInitialTaskShown);
onInitialTaskShownRef.current = onInitialTaskShown;
useEffect(() => {
if (initialSelectedTaskId) {
setDetailTaskId(initialSelectedTaskId);
setShowDetailModal(true);
setFilter('open');
onInitialTaskShownRef.current?.();
api.getThought(initialSelectedTaskId).then((th) => {
if (th) setExtraTask(th);
}).catch(() => {});