diff --git a/src/components/RestAPI/index.tsx b/src/components/RestAPI/index.tsx index e16a90f4..7897dfba 100644 --- a/src/components/RestAPI/index.tsx +++ b/src/components/RestAPI/index.tsx @@ -57,10 +57,16 @@ const defaultState = { }; const normalizeOrders = (orders: SortBy[]) => { - return (orders || []).reduce( - (acc, cur) => ({ ...acc, [cur.id]: cur.desc ? "desc" : "asc" }), - {} - ); + // Drop the "no order selected" placeholder the query builder emits + // (`emptyCube.emptyKey`). The legacy Cube planner silently ignored the + // unresolvable member; the Tesseract planner rejects it with + // "Cannot resolve: emptyCube", which 500s the query. + return (orders || []) + .filter((cur) => cur.id && cur.id !== "emptyCube.emptyKey") + .reduce( + (acc, cur) => ({ ...acc, [cur.id]: cur.desc ? "desc" : "asc" }), + {} + ); }; const FORMAT_OPTIONS = [ diff --git a/src/hooks/useFormatExport.ts b/src/hooks/useFormatExport.ts index 96470330..69c0314f 100644 --- a/src/hooks/useFormatExport.ts +++ b/src/hooks/useFormatExport.ts @@ -14,10 +14,16 @@ interface UseFormatExportOptions { } const normalizeOrders = (orders: SortBy[]) => { - return (orders || []).reduce( - (acc, cur) => ({ ...acc, [cur.id]: cur.desc ? "desc" : "asc" }), - {} - ); + // Drop the "no order selected" placeholder the query builder emits + // (`emptyCube.emptyKey`). The legacy Cube planner silently ignored the + // unresolvable member; the Tesseract planner rejects it with + // "Cannot resolve: emptyCube", which 500s the query. + return (orders || []) + .filter((cur) => cur.id && cur.id !== "emptyCube.emptyKey") + .reduce( + (acc, cur) => ({ ...acc, [cur.id]: cur.desc ? "desc" : "asc" }), + {} + ); }; const getFileNameFromDisposition = (header: string | null) => {