Focus request/folder after creation

This commit is contained in:
Gregory Schier
2025-11-11 14:11:43 -08:00
parent 8164a61376
commit 7b6278405c
19 changed files with 138 additions and 86 deletions

View File

@@ -11,8 +11,8 @@ export async function createRequestAndNavigate<
if (patch.sortPriority === undefined) {
if (activeRequest != null) {
// Place above currently active request
patch.sortPriority = activeRequest.sortPriority - 0.0001;
// Place below the currently active request
patch.sortPriority = activeRequest.sortPriority;
} else {
// Place at the very top
patch.sortPriority = -Date.now();
@@ -27,4 +27,5 @@ export async function createRequestAndNavigate<
params: { workspaceId: patch.workspaceId },
search: (prev) => ({ ...prev, request_id: newId }),
});
return newId;
}

View File

@@ -13,7 +13,7 @@ export async function duplicateRequestOrFolderAndNavigate(
const newId = await duplicateModel(model);
const workspaceId = jotaiStore.get(activeWorkspaceIdAtom);
if (workspaceId == null) return;
if (workspaceId == null || model.model === 'folder') return;
navigateToRequestOrFolderOrWorkspace(newId, model.model);
}

View File

@@ -19,7 +19,7 @@ export function setWorkspaceSearchParams(
(router as any).navigate({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
search: (prev: any) => {
console.log('Navigating to', { prev, search });
// console.log('Navigating to', { prev, search });
return { ...prev, ...search };
},
});