mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-27 02:58:34 +02:00
Fix sidebar reselection after dragging non-selelected item or renaming
This commit is contained in:
@@ -57,7 +57,7 @@ import { InlineCode } from './core/InlineCode';
|
|||||||
import type { InputHandle } from './core/Input';
|
import type { InputHandle } from './core/Input';
|
||||||
import { Input } from './core/Input';
|
import { Input } from './core/Input';
|
||||||
import { LoadingIcon } from './core/LoadingIcon';
|
import { LoadingIcon } from './core/LoadingIcon';
|
||||||
import { collapsedFamily, isSelectedFamily } from './core/tree/atoms';
|
import { collapsedFamily, isSelectedFamily, selectedIdsFamily } from './core/tree/atoms';
|
||||||
import type { TreeNode } from './core/tree/common';
|
import type { TreeNode } from './core/tree/common';
|
||||||
import type { TreeHandle, TreeProps } from './core/tree/Tree';
|
import type { TreeHandle, TreeProps } from './core/tree/Tree';
|
||||||
import { Tree } from './core/tree/Tree';
|
import { Tree } from './core/tree/Tree';
|
||||||
@@ -164,8 +164,10 @@ function Sidebar({ className }: { className?: string }) {
|
|||||||
if (n == null) return;
|
if (n == null) return;
|
||||||
const activeId = jotaiStore.get(activeIdAtom);
|
const activeId = jotaiStore.get(activeIdAtom);
|
||||||
if (activeId == null) return;
|
if (activeId == null) return;
|
||||||
|
const selectedIds = jotaiStore.get(selectedIdsFamily(treeId));
|
||||||
|
if (selectedIds.length > 0) return;
|
||||||
n.selectItem(activeId);
|
n.selectItem(activeId);
|
||||||
}, []);
|
}, [treeId]);
|
||||||
|
|
||||||
// Ensure active id is always selected when it changes
|
// Ensure active id is always selected when it changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user