Skip to content

Commit

Permalink
[fix] serializeLayer fixes (#2343)
Browse files Browse the repository at this point in the history
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
  • Loading branch information
igorDykhta committed Oct 2, 2023
1 parent 4383bff commit b5405f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/reducers/src/vis-state-updaters.ts
Expand Up @@ -406,9 +406,11 @@ export function applyLayerConfigUpdater(
return nextState;
}

const serializedOldLayer = serializeLayer(oldLayer, state.schema);
// serializeLayer() might return null if the old layer is not valid,
// we should still apply the changes in that case
const serializedOldLayer = serializeLayer(oldLayer, state.schema) ?? {config: {}};
const serializedNewLayer = serializeLayer(newLayer, state.schema);
if (!serializedNewLayer || !serializedOldLayer) {
if (!serializedNewLayer) {
return state;
}
if (!isEqual(serializedOldLayer, serializedNewLayer)) {
Expand Down

0 comments on commit b5405f5

Please sign in to comment.