Skip to content

fix(queries): do not fail on response with 200 code and null body #1304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
const {schema, ...rest} = params;

// FIXME: base64 is passed both to params and body to work on versions before and after 24-3
return this.post<QueryAPIResponse<Action, Schema> | ErrorResponse>(
return this.post<QueryAPIResponse<Action, Schema> | ErrorResponse | null>(
this.getPath('/viewer/json/query'),
{...rest, base64},
{schema, base64},
Expand Down
2 changes: 1 addition & 1 deletion src/store/reducers/cluster/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function getGroupStats(data?: KeyValueRow[] | TStorageStats[]) {
}

export const parseGroupsStatsQueryResponse = (
data: ExecuteQueryResponse<'modern'>,
data: ExecuteQueryResponse<'modern'> | null,
): ClusterGroupsStats => {
const parsedData = parseQueryAPIExecuteResponse(data).result;
return getGroupStats(parsedData);
Expand Down
2 changes: 1 addition & 1 deletion src/store/reducers/executeQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export const executeQueryApi = api.injectEndpoints({
}

const data = parseQueryAPIExecuteResponse(response);
data.traceId = response._meta?.traceId;
data.traceId = response?._meta?.traceId;

const queryStats: QueryStats = {};
if (data.stats) {
Expand Down
2 changes: 1 addition & 1 deletion src/store/reducers/explainQuery/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const explainVersions = {
const supportedExplainQueryVersions = Object.values(explainVersions);

export const prepareExplainResponse = (
response: ExplainScriptResponse | ExplainQueryResponse,
response: ExplainScriptResponse | ExplainQueryResponse | null,
): PreparedExplainResponse => {
const {plan: rawPlan, ast} = parseQueryAPIExplainResponse(response);

Expand Down
2 changes: 1 addition & 1 deletion src/store/reducers/viewSchema/viewSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const viewSchemaApi = api.injectEndpoints({
return {error: response};
}

return {data: response.columns || []};
return {data: response?.columns || []};
} catch (error) {
return {error: error};
}
Expand Down
Loading