Skip to content

Commit 7211713

Browse files
authored
fix: convert proxy to plain object for layer data (#102)
1 parent 1d90ad5 commit 7211713

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/engines/Cesium/Feature/utils.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
GroundPrimitive,
1818
} from "cesium";
1919
import md5 from "js-md5";
20-
import { pick } from "lodash-es";
20+
import { cloneDeep, pick } from "lodash-es";
2121
import {
2222
ComponentProps,
2323
ComponentType,
@@ -236,13 +236,20 @@ export const extractSimpleLayer = (
236236
if (l?.type !== "simple") {
237237
return;
238238
}
239-
return l;
239+
// Proxy object lead to issues when creating mvt imagery provider, so convert to plain object
240+
// Not sure for other types, but to keep consistency, convert all simple layers here
241+
// It should be okey since simple layer data is supposed to be simple enough and computed data should not be included
242+
return toPlainObject(l);
240243
};
241244

242245
export const extractSimpleLayerData = (layer: ComputedLayer | undefined): Data | undefined => {
243246
return extractSimpleLayer(layer)?.data;
244247
};
245248

249+
export const toPlainObject = <T,>(obj: T): T => {
250+
return cloneDeep(obj);
251+
};
252+
246253
export const toColor = (c?: string) => {
247254
if (!c || typeof c !== "string") return undefined;
248255

0 commit comments

Comments
 (0)