Skip to content

Commit

Permalink
[Fix] vis state schema column save undefined typeerror (#2211)
Browse files Browse the repository at this point in the history
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
Co-authored-by: Jacob Wasilkowski <4933392+jwasilgeo@users.noreply.github.com>
  • Loading branch information
igorDykhta and jwasilgeo committed May 3, 2023
1 parent d8a5def commit c130a2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/schemas/src/vis-state-schema.ts
Expand Up @@ -382,7 +382,8 @@ class ColumnSchemaV1 extends Schema {
[this.key]: Object.keys(columns).reduce(
(accu, ckey) => ({
...accu,
[ckey]: columns[ckey].value
// if value is null, don't save it
...(columns[ckey]?.value ? {[ckey]: columns[ckey].value} : {})
}),
{}
)
Expand Down
6 changes: 2 additions & 4 deletions test/helpers/mock-state.js
Expand Up @@ -684,8 +684,7 @@ export const expectedSavedLayer1 = {
color: [0, 0, 0],
columns: {
lat: 'gps_data.lat',
lng: 'gps_data.lng',
altitude: null
lng: 'gps_data.lng'
},
textLabel: [
{
Expand Down Expand Up @@ -740,8 +739,7 @@ export const expectedLoadedLayer1 = {
color: [0, 0, 0],
columns: {
lat: 'gps_data.lat',
lng: 'gps_data.lng',
altitude: null
lng: 'gps_data.lng'
},
hidden: false,
isVisible: true,
Expand Down

0 comments on commit c130a2f

Please sign in to comment.