Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion examples/playground/src/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// This configuration object determines which deck.gl classes are accessible in Playground

import {MapView, FirstPersonView, OrbitView, OrthographicView} from '@deck.gl/core';
import {MapView, FirstPersonView, OrbitView, OrthographicView, View, Layer} from '@deck.gl/core';
import * as Layers from '@deck.gl/layers';
import * as AggregationLayers from '@deck.gl/aggregation-layers';
import * as GeoLayers from '@deck.gl/geo-layers';
Expand Down Expand Up @@ -57,5 +57,19 @@ export default {
constants: {
Tiles3DLoader,
CesiumIonLoader
},

postProcessConvertedJson: json => {
// Filter out invalid props. Typically, props will be invalid while the user is typing.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several ways to address this.
Perhaps we could make deck more resilient and not fail on one bad component...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I figured it was for a bit of perf gains, and to keep things simpler. It could be argued that only something like this json module would need validation since here the end user is hooking into props directly whereas most apps have some abstraction in-between.

On the flip side, validation can be this simple.

if (json.layers) {
json.layers = json.layers.filter(layer => layer instanceof Layer);
}
if (json.widgets) {
json.widgets = json.widgets.filter(widget => typeof widget.onAdd === 'function');
}
if (json.views && !(json.views instanceof View)) {
json.views = json.views.filter(view => view instanceof View);
}
return json;
}
};
Loading