Skip to content

Commit 2c55107

Browse files
fix: add checks for fetch failure with no errors
1 parent 98674db commit 2c55107

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/store/reducers/schema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const initialState = {
1818
showPreview: false,
1919
};
2020

21-
const schema = function z(state = initialState, action) {
21+
const schema = (state = initialState, action) => {
2222
switch (action.type) {
2323
case FETCH_SCHEMA.REQUEST: {
2424
return {
@@ -44,7 +44,7 @@ const schema = function z(state = initialState, action) {
4444
};
4545
}
4646
case FETCH_SCHEMA.FAILURE: {
47-
if (action.error.isCancelled) {
47+
if (action.error?.isCancelled) {
4848
return state;
4949
}
5050

src/store/reducers/storage.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const initialState = {
3939
type: StorageTypes.groups,
4040
};
4141

42-
const storage = function z(state = initialState, action) {
42+
const storage = (state = initialState, action) => {
4343
switch (action.type) {
4444
case FETCH_STORAGE.REQUEST: {
4545
return {
@@ -57,10 +57,8 @@ const storage = function z(state = initialState, action) {
5757
};
5858
}
5959
case FETCH_STORAGE.FAILURE: {
60-
if (action.error.isCancelled) {
61-
return {
62-
...state,
63-
};
60+
if (action.error?.isCancelled) {
61+
return state;
6462
}
6563

6664
return {
@@ -239,7 +237,9 @@ export const getFlatListStorageGroups = createSelector([getStoragePools], (stora
239237
);
240238
const mediaType = group.VDisks?.reduce((type, vdisk) => {
241239
const currentType = getPDiskType(vdisk.PDisk || {});
242-
return currentType && (currentType === type || type === '') ? currentType : 'Mixed';
240+
return currentType && (currentType === type || type === '')
241+
? currentType
242+
: 'Mixed';
243243
}, '');
244244
return [
245245
...acc,

0 commit comments

Comments
 (0)