Skip to content

Commit d4a5e51

Browse files
lixun910bdjulbic
authored andcommitted
fix: name new point layer using label if provided (follow-up) (keplergl#3297)
Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
1 parent 929014f commit d4a5e51

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/layers/src/point-layer/point-layer.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,10 @@ export default class PointLayer extends Layer {
347347
columns?: PointLayerColumnsConfig;
348348
} = {
349349
label:
350-
pair.defaultName ||
351-
(typeof label === 'string' && label.replace(/\.[^/.]+$/, '')) ||
352-
'Point'
350+
// Skip the generic 'point' fallback from findPointFieldPairs and use the dataset label instead
351+
pair.defaultName && pair.defaultName !== 'point'
352+
? pair.defaultName
353+
: (typeof label === 'string' && label.replace(/\.[^/.]+$/, '')) || 'Point'
353354
};
354355

355356
// default layer color for begintrip and dropoff point

test/node/utils/layer-utils-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ test('layerUtils -> findDefaultLayer.1', t => {
164164
}
165165
}),
166166
new PointLayer({
167-
label: 'point',
167+
label: 'Point',
168168
dataId,
169169
columns: {
170170
lat: {

0 commit comments

Comments
 (0)