Skip to content

fix: truncate map tooltips - #3299

Closed
bdjulbic wants to merge 11 commits into
keplergl:masterfrom
bdjulbic:fix/truncate-map-tooltips
Closed

fix: truncate map tooltips#3299
bdjulbic wants to merge 11 commits into
keplergl:masterfrom
bdjulbic:fix/truncate-map-tooltips

Conversation

@bdjulbic

@bdjulbic bdjulbic commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Rollback of #3298
The previous fix for hiding geometry fields in tooltips wasn't covering all use cases.

Problem: Geometry fields loaded as strings via CSV (displayed as vector tilesets) show excessively long WKT values in map tooltips.
image

Solution: Apply truncation to tooltip values exceeding 60 characters, shortening them to 30 characters with ellipsis. This handles all long string values uniformly without needing to detect specific field types.
Screenshot 2026-02-06 at 14 52 58

Copilot AI review requested due to automatic review settings February 6, 2026 13:47
Comment on lines -14 to -16
// Returns true if the value is likely a WKT geometry string (heuristic check).
const WKT_PREFIX_RE =
/^(?:SRID=\d+\s*;\s*)?(?:POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)(?:\s+(?:Z|M|ZM))?\s*\(/i;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am rollbacking this previous change
and applying a simpler truncate label

Comment on lines -95 to -97
test('datasetUtils.isWkt', t => {
// non-strings
t.notOk(isWkt(null), 'null is not a valid WKT');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am rollbacking this previous change
and applying a simpler truncate label

@bdjulbic
bdjulbic force-pushed the fix/truncate-map-tooltips branch from 2070e0f to 952aa78 Compare February 6, 2026 13:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates hover tooltip rendering to prevent extremely long string values from overflowing, but also includes unrelated removals in common-utils (WKT detection) and associated tests.

Changes:

  • Truncate long tooltip values in LayerHoverInfo rows using lodash/truncate.
  • Remove isWkt helper and WKT-based geometry inference from common-utils.
  • Remove WKT-related tests (and inadvertently remove the isHexWkb import used by remaining tests).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
test/node/utils/dataset-utils-test.js Removes common-utils imports and deletes the isWkt test block (leaving isHexWkb references without an import).
src/components/src/map/layer-hover-info.tsx Truncates long string values before rendering in hover tooltip rows.
src/common-utils/src/data-type.ts Removes isWkt export and stops inferring geometry-from-string via WKT in getFieldsFromData.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/node/utils/dataset-utils-test.js Outdated
Comment on lines 12 to 16
const H3_ANALYZER_TYPE = 'H3';

// Returns true if the value is likely a WKT geometry string (heuristic check).
const WKT_PREFIX_RE =
/^(?:SRID=\d+\s*;\s*)?(?:POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)(?:\s+(?:Z|M|ZM))?\s*\(/i;

export function isWkt(value: unknown): boolean {
if (typeof value !== 'string') {
return false;
}

const s = value.trim();
if (s.length < 10) {
return false;
}

if (!s.includes('(') || !s.includes(')')) {
return false;
}

return WKT_PREFIX_RE.test(s);
}

export const ACCEPTED_ANALYZER_TYPES = [
AnalyzerDATA_TYPES.DATE,
AnalyzerDATA_TYPES.TIME,

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

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

This change removes the exported isWkt helper from @kepler.gl/common-utils (it was previously re-exported via src/common-utils/src/index.ts). That’s a breaking public API change and is also unrelated to the PR’s stated goal (“truncate map tooltips”). Consider restoring isWkt (or keeping a deprecated re-export) and moving any API removals into a dedicated major-version PR.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are rollbacking this, no need for isWkt which was added in previous PR

Comment on lines 264 to 268

// quick check if string is hex wkb
if (type === AnalyzerDATA_TYPES.STRING) {
type = data.some(d => isHexWkb(d[name])) ? AnalyzerDATA_TYPES.GEOMETRY : type;
}

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

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

getFieldsFromData no longer performs the WKT quick-check and therefore won’t detect WKT geometry stored as strings (only hex WKB). This is a behavior regression for datasets that contain WKT columns and can prevent geometry layers from being created. If WKT support is still desired, restore the WKT detection here (or replace it with an equivalent) and keep/adjust the associated tests.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are rollbacking this, no need for isWkt which was added in previous PR

bdjulbic and others added 9 commits February 6, 2026 14:57
…ds (keplergl#3294)

* fix tooltip coordinate

Signed-off-by: bdjulbic <bdjulbic@foursquare.com>

* reformat and add test

Signed-off-by: bdjulbic <bdjulbic@foursquare.com>

---------

Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: bdjulbic <bdjulbic@foursquare.com>
@bdjulbic
bdjulbic force-pushed the fix/truncate-map-tooltips branch from c114861 to 14ea63d Compare February 6, 2026 13:57
…oltips

# Conflicts:
#	test/node/utils/dataset-utils-test.js
@bdjulbic bdjulbic closed this Feb 6, 2026
@bdjulbic
bdjulbic deleted the fix/truncate-map-tooltips branch March 17, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants