• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geosolutions-it / MapStore2 / 15704025608

17 Jun 2025 09:52AM UTC coverage: 76.967% (+0.007%) from 76.96%
15704025608

push

github

web-flow
Remove object assign pollyfills (#11214)

* chore: Remove unused package babel-plugin-object-assign

* chore: Remove es6-object-assign

* refactor: Replace object-assign with Object.assign

* Fixed other object assign

* Thanks to @jna-nordiq for this contribution

---------

Co-authored-by: Jonas <jonasnaursgaard.jensen@sweco.dk>

31117 of 48419 branches covered (64.27%)

457 of 567 new or added lines in 94 files covered. (80.6%)

4 existing lines in 3 files now uncovered.

38718 of 50305 relevant lines covered (76.97%)

36.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.68
/web/client/utils/MapHistoryUtils.js
1
/**
2
 * Copyright 2015, GeoSolutions Sas.
3
 * All rights reserved.
4
 *
5
 * This source code is licensed under the BSD-style license found in the
6
 * LICENSE file in the root directory of this source tree.
7
 */
8
import undoable, {ActionTypes} from 'redux-undo';
9
import { isEqual } from 'lodash';
10

11
const mapConfigHistoryUtil = (reducer) => {
1✔
12
    return (state, action) => {
1✔
13
        let newState = reducer(state, action);
22✔
14
        let unredoState;
15
        // If undo modified the state we change mapStateSource
16
        if (action.type === ActionTypes.UNDO && state.past.length > 0) {
22!
NEW
17
            let mapC = Object.assign({}, newState.present, {mapStateSource: "undoredo", style: state.present.style, resize: state.present.resize});
×
NEW
18
            unredoState = Object.assign({}, newState, {present: mapC});
×
19
        } else if (action.type === ActionTypes.REDO && state.future.length > 0) {
22!
NEW
20
            let mapC = Object.assign({}, newState.present, {mapStateSource: "undoredo", style: state.present.style, resize: state.present.resize});
×
NEW
21
            unredoState = Object.assign({}, newState, {present: mapC});
×
22
        }
23
        return unredoState || {past: newState.past, present: newState.present, future: newState.future};
22✔
24
    };
25
};
26

27

28
export const createHistory = (mapState) => {
1✔
29
    if (mapState && mapState.map && mapState.map.center) {
63✔
30
        return Object.assign({}, mapState, {
4✔
31
            map: {
32
                past: [],
33
                present: mapState.map,
34
                future: []
35
            }
36
        });
37
    }
38
    return mapState;
59✔
39
};
40

41
export const mapConfigHistory = (reducer) => mapConfigHistoryUtil(undoable(reducer, {
1✔
42
    filter: (action, currentState, previousState) => {
43
        let bool = false;
22✔
44
        if (previousState && previousState.mapStateSource && previousState.mapStateSource === 'map'
22!
45
                && previousState.center && previousState.zoom !== undefined) {
46
            // Check geometry part
47
            bool = !(isEqual(currentState.center, previousState.center) && currentState.zoom === previousState.zoom);
×
48
        }
49
        return bool;
22✔
50
    }
51
}));
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc