Skip to content

Cannot customize initial state with array of strings #2812

@MV88

Description

@MV88

Description

I tried to customize initial state with the default state of featuregrid reducer and ended up with an error that was raised on opening of the feature grid.
array of string are not handled correctly here
it ended to transform the array ["ADMIN"] into {0: "ADMIN"}

there was also a problem with toChangesMap function in FeatureGridUtils because changes was an empty object instead of an array.

In case of Bug (otherwise remove this paragraph)

Browser Affected
(use this site: https://www.whatsmybrowser.org/ for non expert users)

  • Internet Explorer
  • Chrome
  • Firefox
  • Safari

Browser Version Affected

  • Indicate the browser version in which the issue has been found

Steps to reproduce (on a local environment)

  • Copy default state of feature grid reducer in localconfig
  • try to open a map (nothing shows)

once you have fixed the FeatureGridUtils problem

  • try to open the feature grid

Expected Result

  • the feature grid opened correctly with no errors

Current Result

  • you have an error in the console

Other useful information (optional):

here is the fix for FeatureGridUtils

const {isArray} = require('lodash');
const toChangesMap = (changesArray) => isArray(changesArray) ? changesArray.reduce((changes, c) => ({
    ...changes,
    [c.id]: {
        ...changes[c.id],
        ...c.updated
    }
}), {}) : {};

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions