Skip to content

Commit

Permalink
Fixed the_geom on query form reset (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap authored and offtherailz committed May 15, 2017
1 parent f995801 commit c5c27c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion web/client/reducers/__tests__/queryform-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,17 @@ describe('Test the queryform reducer', () => {
};

const initialState = {
test: true
test: true,
spatialField: {
attribute: "GEOMETRY"
}
};

let state = queryform(initialState, testAction);
expect(state).toExist();

expect(state.test).toEqual(true);
expect(state.spatialField.attribute).toEqual("GEOMETRY");
});

it('Show Generated Filter', () => {
Expand Down
6 changes: 4 additions & 2 deletions web/client/reducers/queryform.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,15 @@ function queryform(state = initialState, action) {
return newState;
}
case REMOVE_SPATIAL_SELECT: {
return assign({}, state, {spatialField: assign({}, state.spatialField, initialState.spatialField)});
let spatialField = assign({}, initialState.spatialField, { attribute: state.spatialField.attribute });
return assign({}, state, {spatialField: assign({}, state.spatialField, spatialField)});
}
case SHOW_SPATIAL_DETAILS: {
return assign({}, state, {showDetailsPanel: action.show});
}
case QUERY_FORM_RESET: {
return assign({}, state, initialState);
let spatialField = assign({}, initialState.spatialField, { attribute: state.spatialField.attribute });
return assign({}, state, initialState, {spatialField});
}
case SHOW_GENERATED_FILTER: {
return assign({}, state, {showGeneratedFilter: action.data});
Expand Down

0 comments on commit c5c27c0

Please sign in to comment.