fix(workspace): focus a jump target only once, not again after every new block
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 15:01:04 +01:00
1 parent 3e4eb9b14f
commit 20b907078f
5 files changed
+19 -7

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "mindsift-frontend",
"version": "0.40.0",
"version": "0.40.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mindsift-frontend",
"version": "0.40.0",
"version": "0.40.1",
"license": "Unlicense",
"dependencies": {
"@fontsource-variable/inter": "5.3.0",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "mindsift-frontend",
"private": true,
"version": "0.40.0",
"version": "0.40.1",
"license": "Unlicense",
"type": "module",
"scripts": {
@@ -181,8 +181,14 @@ export const OutlinerTree = forwardRef<OutlinerTreeHandle, OutlinerTreeProps>(({
}
}, []);
// Jump target (e.g. from a task): focused once, as soon as its block is loaded. Running again on later
// block changes would pull the cursor back to it after every Enter in the note.
const focusedTargetRef = useRef<string | null>(null);
const targetLoaded = !!initialFocusedBlockId && blocks.some((b) => b.id === initialFocusedBlockId);
useEffect(() => {
if (initialFocusedBlockId) {
if (!initialFocusedBlockId) focusedTargetRef.current = null;
if (initialFocusedBlockId && targetLoaded && focusedTargetRef.current !== initialFocusedBlockId) {
focusedTargetRef.current = initialFocusedBlockId;
setHighlightedBlockId(initialFocusedBlockId);
focusBlockInput(initialFocusedBlockId, 'select');
const timer = setTimeout(() => {
@@ -200,7 +206,7 @@ export const OutlinerTree = forwardRef<OutlinerTreeHandle, OutlinerTreeProps>(({
clearTimeout(fadeTimer);
};
}
}, [initialFocusedBlockId, blocks.length, focusBlockInput]);
}, [initialFocusedBlockId, targetLoaded, focusBlockInput]);
// Compute visibility based on collapsed ancestor blocks
const visibleEntries = useMemo(() => {