Skip to content

Commit 4291e38

Browse files
committed
merging up release branch
2 parents f690675 + d05983f commit 4291e38

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

src/SpatialFeaturesLayer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const LINES_LAYER_ID = 'spatial-features-lines';
1818
export const POLYGONS_LAYER_ID = 'spatial-features-polygons';
1919
// const POLYGONS_LABELS_LAYER_ID = 'spatial-features-polygon-labels';
2020

21-
const BEFORE_LAYER_ID = 'sky';
21+
const BEFORE_LAYER_ID = 'feature-separation-layer';
2222

2323
const DEFAULT_LINE_PAINT_COLOR = [
2424
'case',

src/SpatialFeaturesLayer/index.test.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ jest.mock('../ducks/analyzers', () => ({}));
1818
jest.mock('../utils/map', () => ({
1919
addMapImage: jest.fn()
2020
}));
21-
jest.mock('../MessageBadgeLayer', () => ({
22-
LAYER_ID: 'message-badge-layer'
23-
}));
2421

2522
jest.mock('../constants', () => ({
2623
API_URL: 'http://test-api.com/',
@@ -108,7 +105,7 @@ describe('SpatialFeaturesLayer', () => {
108105
['==', ['geometry-type'], 'Point'],
109106
['!', ['in', ['get', 'id'], ['literal', ['hidden-feature-1', 'hidden-feature-2']]]]
110107
])
111-
}), 'message-badge-layer');
108+
}), 'feature-separation-layer');
112109

113110
// Verify line layer was added
114111
expect(mockMap.addLayer).toHaveBeenCalledWith(expect.objectContaining({
@@ -121,7 +118,7 @@ describe('SpatialFeaturesLayer', () => {
121118
['==', ['geometry-type'], 'LineString'],
122119
['!', ['in', ['get', 'id'], ['literal', ['hidden-feature-1', 'hidden-feature-2']]]]
123120
])
124-
}), 'message-badge-layer');
121+
}), 'feature-separation-layer');
125122

126123
// Verify polygon layer was added
127124
expect(mockMap.addLayer).toHaveBeenCalledWith(expect.objectContaining({
@@ -134,7 +131,7 @@ describe('SpatialFeaturesLayer', () => {
134131
['==', ['geometry-type'], 'Polygon'],
135132
['!', ['in', ['get', 'id'], ['literal', ['hidden-feature-1', 'hidden-feature-2']]]]
136133
])
137-
}), 'message-badge-layer');
134+
}), 'feature-separation-layer');
138135

139136
// Verify click handlers were added
140137
expect(mockMap.on).toHaveBeenCalledWith('click', SYMBOLS_LAYER_ID, expect.any(Function));

src/ducks/subjects.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,21 @@ export const clearSubjectData = () => ({
8181
});
8282

8383
export const fetchSubjectGroups = () => dispatch => axios.get(SUBJECT_GROUPS_API_URL)
84-
.then(response => dispatch(fetchSubjectGroupsSuccess(response)));
84+
.then(response => dispatch(fetchSubjectGroupsSuccess(response)))
85+
.catch(_error => dispatch(fetchSubjectGroupsError())); // Fallback to empty array on error
8586

8687
const fetchMapSubjectsSuccess = response => ({
8788
type: FETCH_MAP_SUBJECTS_SUCCESS,
8889
payload: response.data,
8990
});
90-
/*
91-
const fetchMapSubjectsError = error => ({
92-
type: FETCH_MAP_SUBJECTS_ERROR,
93-
payload: error,
94-
});
95-
*/
91+
9692
const fetchSubjectGroupsSuccess = response => ({
9793
type: FETCH_SUBJECT_GROUPS_SUCCESS,
98-
payload: response.data.data,
94+
payload: response?.data?.data ?? [],
9995
});
10096

97+
const fetchSubjectGroupsError = _error => fetchSubjectGroupsSuccess([]);
98+
10199
const INITIAL_MAP_SUBJECT_STATE = {
102100
bbox: null,
103101
subjects: [],

0 commit comments

Comments
 (0)