mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-10 23:02:46 +02:00
Fix sidebar folder dragging collapse
https://feedback.yaak.app/p/a-folder-may-hide-its-content-if-i-move-a
This commit is contained in:
@@ -265,7 +265,7 @@ pub fn git_status(dir: &Path) -> Result<GitStatusSummary> {
|
|||||||
None => None,
|
None => None,
|
||||||
Some(t) => match t.get_path(&Path::new(&rela_path)) {
|
Some(t) => match t.get_path(&Path::new(&rela_path)) {
|
||||||
Ok(entry) => {
|
Ok(entry) => {
|
||||||
let obj = entry.to_object(&repo).unwrap();
|
let obj = entry.to_object(&repo)?;
|
||||||
let content = obj.as_blob().unwrap().content();
|
let content = obj.as_blob().unwrap().content();
|
||||||
let name = Path::new(entry.name().unwrap_or_default());
|
let name = Path::new(entry.name().unwrap_or_default());
|
||||||
SyncModel::from_bytes(content.into(), name)?.map(|m| m.0)
|
SyncModel::from_bytes(content.into(), name)?.map(|m| m.0)
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ export function Sidebar({ className }: Props) {
|
|||||||
const handleEnd = useCallback<SidebarItemProps['onEnd']>(
|
const handleEnd = useCallback<SidebarItemProps['onEnd']>(
|
||||||
async (itemId) => {
|
async (itemId) => {
|
||||||
setHoveredTree(null);
|
setHoveredTree(null);
|
||||||
|
setDraggingId(null);
|
||||||
handleClearSelected();
|
handleClearSelected();
|
||||||
|
|
||||||
if (hoveredTree == null || hoveredIndex == null) {
|
if (hoveredTree == null || hoveredIndex == null) {
|
||||||
@@ -278,9 +279,8 @@ export function Sidebar({ className }: Props) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const sortPriority = afterPriority - (afterPriority - beforePriority) / 2;
|
const sortPriority = afterPriority - (afterPriority - beforePriority) / 2;
|
||||||
return patchModelById(child.model, child.id, { sortPriority, folderId });
|
await patchModelById(child.model, child.id, { sortPriority, folderId });
|
||||||
}
|
}
|
||||||
setDraggingId(null);
|
|
||||||
},
|
},
|
||||||
[handleClearSelected, hoveredTree, hoveredIndex, treeParentMap],
|
[handleClearSelected, hoveredTree, hoveredIndex, treeParentMap],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
type WebsocketRequest,
|
type WebsocketRequest,
|
||||||
} from '@yaakapp-internal/models';
|
} from '@yaakapp-internal/models';
|
||||||
|
|
||||||
// This is an atom so we can use it in the child items to avoid re-rendering the entire list
|
// This is an atom, so we can use it in the child items to avoid re-rendering the entire list
|
||||||
import { atom } from 'jotai';
|
import { atom } from 'jotai';
|
||||||
import { activeWorkspaceAtom } from '../../hooks/useActiveWorkspace';
|
import { activeWorkspaceAtom } from '../../hooks/useActiveWorkspace';
|
||||||
import { allRequestsAtom } from '../../hooks/useAllRequests';
|
import { allRequestsAtom } from '../../hooks/useAllRequests';
|
||||||
|
|||||||
Reference in New Issue
Block a user