Skip to content

Commit 2f39ad0

Browse files
fix(describe): cancel concurrent requests
1 parent d70ba54 commit 2f39ad0

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/services/api.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,17 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
9292
{concurrentId: concurrentId || `getSchema|${path}`},
9393
);
9494
}
95-
getDescribe({path}) {
96-
return this.get(this.getPath('/viewer/json/describe'), {
97-
path,
98-
enums: true,
99-
partition_stats: true,
100-
subs: 0,
101-
});
95+
getDescribe({path}, {concurrentId} = {}) {
96+
return this.get(
97+
this.getPath('/viewer/json/describe'),
98+
{
99+
path,
100+
enums: true,
101+
partition_stats: true,
102+
subs: 0,
103+
},
104+
{concurrentId: concurrentId || `getDescribe|${path}`},
105+
);
102106
}
103107
getSchemaAcl({path}) {
104108
return this.get(

src/store/reducers/describe.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ const describe: Reducer<IDescribeState, IDescribeAction> = (state = initialState
5656
}
5757

5858
case FETCH_DESCRIBE.FAILURE: {
59+
if (action.error?.isCancelled) {
60+
return state;
61+
}
62+
5963
return {
6064
...state,
6165
error: action.error,

src/types/api/error.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export interface IResponseError {
22
data?: unknown;
33
status?: number;
44
statusText?: string;
5+
isCancelled?: boolean;
56
}

0 commit comments

Comments
 (0)