From 2f8f4138af4d4ddcf83d8fe16c9f85235cead2e0 Mon Sep 17 00:00:00 2001 From: Veronika Tsygankova Date: Tue, 10 Nov 2026 17:51:53 +0300 Subject: [PATCH] =?UTF-8?q?[AURORA-1970]=20-=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D1=87=D0=B0=20requestId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../slices/catalogueJurSlice/catalogueJurSlice.ts | 11 ++++++++++- web/src/store/slices/catalogueJurSlice/types.ts | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/web/src/store/slices/catalogueJurSlice/catalogueJurSlice.ts b/web/src/store/slices/catalogueJurSlice/catalogueJurSlice.ts index 2f8cb32..e863b79 100644 --- a/web/src/store/slices/catalogueJurSlice/catalogueJurSlice.ts +++ b/web/src/store/slices/catalogueJurSlice/catalogueJurSlice.ts @@ -10,6 +10,7 @@ const initialState: CatalogueJurSliceType = { total_groups: 0, loading: false, error: null, + currentRequestId: null, isGettingArchive: false, relatedGroupFilter: null, activeCompanyGroup: null, @@ -32,22 +33,30 @@ const catalogueJurSlice = createSlice({ resetRows(state) { state.raw_rows = []; state.total_groups = 0; + // Запрос, начатый до сброса, больше не нужен: его ответ отбросится в fulfilled/rejected + state.currentRequestId = null; + state.loading = false; }, }, extraReducers: (builder) => { builder - .addCase(getCatalogueJurThunk.pending, (state, _) => { + .addCase(getCatalogueJurThunk.pending, (state, action) => { + state.currentRequestId = action.meta.requestId; state.loading = true; state.error = null; }) .addCase(getCatalogueJurThunk.fulfilled, (state, action) => { + if (action.meta.requestId !== state.currentRequestId) return; state.raw_rows = action.payload.items; state.total_groups = action.payload.total; state.loading = false; + state.currentRequestId = null; }) .addCase(getCatalogueJurThunk.rejected, (state, action) => { + if (action.meta.requestId !== state.currentRequestId) return; state.error = action.payload ?? 'Неизвестная ошибка'; state.loading = false; + state.currentRequestId = null; }) // Выбранная ГК — копия строки списка ГК: после перезагрузки списка берём свежую (счётчик ЮЛ в шапке и вкладке) .addCase(getCompanyGroupsThunk.fulfilled, (state, action) => { diff --git a/web/src/store/slices/catalogueJurSlice/types.ts b/web/src/store/slices/catalogueJurSlice/types.ts index 7227c33..9048d8a 100644 --- a/web/src/store/slices/catalogueJurSlice/types.ts +++ b/web/src/store/slices/catalogueJurSlice/types.ts @@ -7,6 +7,7 @@ export interface CatalogueJurSliceType { raw_rows: ICatalogueJur[]; loading: boolean; error: string | null; + currentRequestId: string | null; isGettingArchive: boolean; relatedGroupFilter?: RelatedGroupOut | null; activeCompanyGroup?: ICompanyGroup | null;