Skip to content

Commit

Permalink
rename props
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoji Chen committed Jun 12, 2019
1 parent 86a8255 commit 55c06c0
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
8 changes: 4 additions & 4 deletions modules/layers/src/geojson-layer/geojson-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default class GeoJsonLayer extends CompositeLayer {
this.shouldRenderSubLayer('polygons-fill', polygonFeatures) &&
new PolygonFillLayer(
{
dataDiff: featuresDiff.polygonFeatures && (() => featuresDiff.polygonFeatures),
_dataDiff: featuresDiff.polygonFeatures && (() => featuresDiff.polygonFeatures),

fp64,
extruded,
Expand Down Expand Up @@ -227,7 +227,7 @@ export default class GeoJsonLayer extends CompositeLayer {
this.shouldRenderSubLayer('polygons-stroke', polygonOutlineFeatures) &&
new PolygonStrokeLayer(
{
dataDiff:
_dataDiff:
featuresDiff.polygonOutlineFeatures && (() => featuresDiff.polygonOutlineFeatures),

fp64,
Expand Down Expand Up @@ -267,7 +267,7 @@ export default class GeoJsonLayer extends CompositeLayer {
this.shouldRenderSubLayer('linestrings', lineFeatures) &&
new LineStringsLayer(
{
dataDiff: featuresDiff.lineFeatures && (() => featuresDiff.lineFeatures),
_dataDiff: featuresDiff.lineFeatures && (() => featuresDiff.lineFeatures),

fp64,
widthUnits: lineWidthUnits,
Expand Down Expand Up @@ -306,7 +306,7 @@ export default class GeoJsonLayer extends CompositeLayer {
this.shouldRenderSubLayer('points', pointFeatures) &&
new PointsLayer(
{
dataDiff: featuresDiff.pointFeatures && (() => featuresDiff.pointFeatures),
_dataDiff: featuresDiff.pointFeatures && (() => featuresDiff.pointFeatures),

fp64,
stroked,
Expand Down
6 changes: 3 additions & 3 deletions modules/layers/src/polygon-layer/polygon-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default class PolygonLayer extends CompositeLayer {
// Layer composition props
const {
data,
dataDiff,
_dataDiff,
stroked,
filled,
extruded,
Expand Down Expand Up @@ -187,7 +187,7 @@ export default class PolygonLayer extends CompositeLayer {
this.shouldRenderSubLayer('fill', paths) &&
new FillLayer(
{
dataDiff,
_dataDiff,
extruded,
elevationScale,

Expand Down Expand Up @@ -224,7 +224,7 @@ export default class PolygonLayer extends CompositeLayer {
this.shouldRenderSubLayer('stroke', paths) &&
new StrokeLayer(
{
dataDiff: pathsDiff && (() => pathsDiff),
_dataDiff: pathsDiff && (() => pathsDiff),
fp64,
widthUnits: lineWidthUnits,
widthScale: lineWidthScale,
Expand Down
2 changes: 1 addition & 1 deletion modules/layers/src/text-layer/text-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export default class TextLayer extends CompositeLayer {
iconAtlas,
iconMapping,

dataDiff: dataDiff && (() => dataDiff),
_dataDiff: dataDiff && (() => dataDiff),

getPosition: this._getAccessor(getPosition),
getColor: this._getAccessor(getColor),
Expand Down
4 changes: 2 additions & 2 deletions modules/test-utils/src/generate-layer-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ function makeAltDataTestCases(props, propTypes) {
// partial update
const partialUpdateProps = {
data: originalData.slice(),
dataDiff: () => [{startRow: 0, endRow: 2}]
_dataDiff: () => [{startRow: 0, endRow: 2}]
};
// data should support any iterable
const genIterableProps = {
data: new Set(originalData),
dataDiff: null
_dataDiff: null
};
// data in non-iterable form
const nonIterableProps = {
Expand Down
5 changes: 3 additions & 2 deletions test/modules/layers/geojson-layer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test('GeoJsonLayer#tests', t => {
testCases.push({
title: 'GeoJsonLayer#',
onBeforeUpdate: ({testCase}) => t.comment(testCase.title),
onAfterUpdate: ({layer}) => {
onAfterUpdate: ({layer, subLayers}) => {
const {featuresDiff} = layer.state;
t.deepEquals(
featuresDiff,
Expand All @@ -60,10 +60,11 @@ test('GeoJsonLayer#tests', t => {
},
'created diff for subLayers'
);
t.ok(subLayers.every(l => l.props._dataDiff), "sublayers' dataDiff prop is populated");
},
updateProps: {
data: Object.assign({}, FIXTURES.choropleths),
dataDiff: () => [{startRow: 0, endRow: 3}]
_dataDiff: () => [{startRow: 0, endRow: 3}]
}
});

Expand Down
2 changes: 1 addition & 1 deletion test/modules/layers/polygon-layer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test('PolygonLayer', t => {
if (layer.props.data && layer.props.data.length) {
t.ok(layer.state.paths.length, 'should update state.paths');
}
if (layer.props.dataDiff) {
if (layer.props._dataDiff) {
t.ok(Array.isArray(layer.state.pathsDiff), 'created diff for sub path layer');
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/modules/layers/text-layer/text-layer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('TextLayer', t => {
t.ok(layer.state.data.length, 'Creates sublayer data');
t.ok(subLayer, 'Renders sublayer');
}
if (layer.props.dataDiff) {
if (layer.props._dataDiff) {
t.ok(Array.isArray(layer.state.dataDiff), 'created diff for sublayer');
}
}
Expand Down

0 comments on commit 55c06c0

Please sign in to comment.