Skip to content

Commit d115989

Browse files
authored
fix(queries): do not fail on response with 200 code and null body (#1304)
1 parent 6d65839 commit d115989

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/services/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
558558
const {schema, ...rest} = params;
559559

560560
// FIXME: base64 is passed both to params and body to work on versions before and after 24-3
561-
return this.post<QueryAPIResponse<Action, Schema> | ErrorResponse>(
561+
return this.post<QueryAPIResponse<Action, Schema> | ErrorResponse | null>(
562562
this.getPath('/viewer/json/query'),
563563
{...rest, base64},
564564
{schema, base64},

src/store/reducers/cluster/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function getGroupStats(data?: KeyValueRow[] | TStorageStats[]) {
8686
}
8787

8888
export const parseGroupsStatsQueryResponse = (
89-
data: ExecuteQueryResponse<'modern'>,
89+
data: ExecuteQueryResponse<'modern'> | null,
9090
): ClusterGroupsStats => {
9191
const parsedData = parseQueryAPIExecuteResponse(data).result;
9292
return getGroupStats(parsedData);

src/store/reducers/executeQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export const executeQueryApi = api.injectEndpoints({
258258
}
259259

260260
const data = parseQueryAPIExecuteResponse(response);
261-
data.traceId = response._meta?.traceId;
261+
data.traceId = response?._meta?.traceId;
262262

263263
const queryStats: QueryStats = {};
264264
if (data.stats) {

src/store/reducers/explainQuery/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const explainVersions = {
1313
const supportedExplainQueryVersions = Object.values(explainVersions);
1414

1515
export const prepareExplainResponse = (
16-
response: ExplainScriptResponse | ExplainQueryResponse,
16+
response: ExplainScriptResponse | ExplainQueryResponse | null,
1717
): PreparedExplainResponse => {
1818
const {plan: rawPlan, ast} = parseQueryAPIExplainResponse(response);
1919

src/store/reducers/viewSchema/viewSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const viewSchemaApi = api.injectEndpoints({
2424
return {error: response};
2525
}
2626

27-
return {data: response.columns || []};
27+
return {data: response?.columns || []};
2828
} catch (error) {
2929
return {error: error};
3030
}

0 commit comments

Comments
 (0)