Skip to content

Commit

Permalink
fix(workbenchRoutes): recent qriRefs adjusted correctly
Browse files Browse the repository at this point in the history
Previously, each newly added history ref was reseting the edit ref, and each edit ref was reseting the history ref.

Ensure that empty values don't muck up the logic.
  • Loading branch information
ramfox committed Oct 1, 2020
1 parent 62aa7a6 commit 831bd11
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/reducers/workbenchRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const WORKBENCH_ROUTES_CLEAR = 'WORKBENCH_ROUTES_CLEAR'
export default (state = initialState, action: AnyAction) => {
switch (action.type) {
case WORKBENCH_ROUTES_HISTORY_REF:
if (state.historyRef.username !== action.qriRef.username ||
state.historyRef.name !== action.qriRef.name) {
if ((state.historyRef.username !== '' && state.historyRef.username !== action.qriRef.username) ||
(state.historyRef.name !== '' && state.historyRef.name !== action.qriRef.name)) {
return {
...initialState,
historyRef: action.qriRef,
Expand All @@ -39,8 +39,8 @@ export default (state = initialState, action: AnyAction) => {
location: action.qriRef.location
}
case WORKBENCH_ROUTES_EDIT_REF:
if (state.editRef.username !== action.qriRef.username ||
state.editRef.name !== action.qriRef.name) {
if ((state.editRef.username !== '' && state.editRef.username !== action.qriRef.username) ||
(state.editRef.name !== '' && state.editRef.name !== action.qriRef.name)) {
return {
...initialState,
editRef: action.qriRef,
Expand Down

0 comments on commit 831bd11

Please sign in to comment.