Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const getCollectionItem = async (id: string) => {
};

export async function clientAction({ request }: Route.ClientActionArgs) {
const { id, targetId, dropPosition, metaSortKey } = await request.json();
const { id, targetId, dropPosition, metaSortKey, parentId: requestedParentId } = await request.json();
invariant(typeof id === 'string', 'ID is required');
invariant(typeof targetId === 'string', 'Target ID is required');

Expand Down Expand Up @@ -53,7 +53,15 @@ export async function clientAction({ request }: Route.ClientActionArgs) {
const item = await getCollectionItem(id);
const targetItem = await getCollectionItem(targetId);

const parentId = dropPosition === 'after' && isRequestGroup(targetItem) ? targetItem._id : targetItem.parentId;
// The sidebar resolves its own destination and sends it outright, from the
// same value its drop indicator renders. Other callers (debug.tsx onReorder)
// omit it and get the old "after a folder means into it" inference.
const parentId =
typeof requestedParentId === 'string'
? requestedParentId
: dropPosition === 'after' && isRequestGroup(targetItem)
? targetItem._id
: targetItem.parentId;

await (isRequestGroup(item)
? services.requestGroup.update(item, { parentId, metaSortKey })
Expand All @@ -79,6 +87,8 @@ export const useDebugReorderActionFetcher = createFetcherSubmitHook(
targetId: string;
dropPosition: string;
metaSortKey: number;
// Destination parent, when the caller resolved it itself.
parentId?: string;
}
| {
type: 'move-workspace';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ const ProjectNavigationSidebarInner = (
virtualizer,
onWorkspaceReorder: handleLocalWorkspaceReorder,
expandedProjectAndWorkspaceIds,
depthOffset: treeDepthOffset,
});
const { selectedItemId, routeInfo } = useProjectNavigationSidebarNavigation({
setActiveTab,
Expand Down
Loading
Loading