From a35e99bacfb323410f0b467ab7a7ff4e5efeab06 Mon Sep 17 00:00:00 2001 From: Jack Kavanagh Date: Tue, 29 Aug 2023 11:12:45 +0200 Subject: [PATCH] fix invariant exception (#6410) --- packages/insomnia/src/ui/routes/actions.tsx | 2 +- packages/insomnia/src/ui/routes/debug.tsx | 28 +++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/insomnia/src/ui/routes/actions.tsx b/packages/insomnia/src/ui/routes/actions.tsx index db3e4df5c..ad07cff8f 100644 --- a/packages/insomnia/src/ui/routes/actions.tsx +++ b/packages/insomnia/src/ui/routes/actions.tsx @@ -967,7 +967,7 @@ export const reorderCollectionAction: ActionFunction = async ({ request, params invariant(typeof id === 'string', 'ID is required'); invariant(typeof targetId === 'string', 'Target ID is required'); invariant(typeof dropPosition === 'string', 'Drop position is required'); - invariant(metaSortKey, 'MetaSortKey position is required'); + invariant(typeof metaSortKey === 'number', 'MetaSortKey position is required'); if (id === targetId) { return null; diff --git a/packages/insomnia/src/ui/routes/debug.tsx b/packages/insomnia/src/ui/routes/debug.tsx index 3007636bf..62847e5c3 100644 --- a/packages/insomnia/src/ui/routes/debug.tsx +++ b/packages/insomnia/src/ui/routes/debug.tsx @@ -472,19 +472,21 @@ export const Debug: FC = () => { } } - reorderFetcher.submit( - { - targetId, - id, - dropPosition: event.target.dropPosition, - metaSortKey, - }, - { - action: `/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug/reorder`, - method: 'POST', - encType: 'application/json', - } - ); + if (metaSortKey) { + reorderFetcher.submit( + { + targetId, + id, + dropPosition: event.target.dropPosition, + metaSortKey, + }, + { + action: `/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug/reorder`, + method: 'POST', + encType: 'application/json', + } + ); + } }, renderDropIndicator(target) { return (