[AURORA-1970]: Справочники: состав ГСК/ГСЗ и реестр «ЮЛ вне ГК» #221

Merged
aep merged 2 commits from fix/aurora-1970-update-design into main 2026-11-11 11:37:44 +03:00
2 changed files with 11 additions and 1 deletions
Showing only changes of commit 2f8f4138af - Show all commits

View File

@ -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) => {

View File

@ -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;