Skip to content

Commit aa7f015

Browse files
committed
don't check for invalid projectIds in SET_PROJECT_ID action
1 parent f895857 commit aa7f015

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/reducers/project-state.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,19 @@ const reducer = function (state, action) {
161161
return state;
162162
case SET_PROJECT_ID:
163163
// if we were already showing a project, and a different projectId is set, only fetch that project if
164-
// projectId is a valid id, and projectId has changed. This prevents re-fetching projects unnecessarily.
165-
if (action.id !== null && action.id !== '' && typeof action.id !== 'undefined') {
166-
if (state.loadingState === LoadingState.SHOWING_WITH_ID) {
167-
if (state.projectId !== action.id) {
168-
return Object.assign({}, state, {
169-
loadingState: LoadingState.FETCHING_WITH_ID,
170-
projectId: action.id
171-
});
172-
}
173-
} else { // allow any other states to transition to fetching project
164+
// projectId has changed. This prevents re-fetching projects unnecessarily.
165+
if (state.loadingState === LoadingState.SHOWING_WITH_ID) {
166+
if (state.projectId !== action.id) {
174167
return Object.assign({}, state, {
175168
loadingState: LoadingState.FETCHING_WITH_ID,
176169
projectId: action.id
177170
});
178171
}
172+
} else { // allow any other states to transition to fetching project
173+
return Object.assign({}, state, {
174+
loadingState: LoadingState.FETCHING_WITH_ID,
175+
projectId: action.id
176+
});
179177
}
180178
return state;
181179
case START_FETCHING_NEW_WITHOUT_SAVING:

0 commit comments

Comments
 (0)