Repository navigation
fix(analytics): show only the hotspot label in the layer rail #2078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The separator cleanup is greedy across dashes, so it can also eat a dash that belongs to the hotspot's own label.
/^[\s\p{Pd}]+/uconsumes every leading whitespace/dash character, not just the one separator. A hotspot named-50% offinside a layer namedSummer saleis tracked asSummer sale — -50% off(hotspotLayerManager.jscomposes${parentLayerName} — ${subLabel}). Afterslice()the remainder is" — -50% off", and the character class then swallows space + em dash + space and the label's own hyphen, so the rail row reads50% off— the opposite meaning. Same for something like—Limited—.Anchoring the strip to a single separator occurrence keeps the label intact, e.g.:
(or only strip when the composite actually matches
parent + SEP). Minor/edge-case — everything else in the change looks right to me: the! md.product_nameguard correctly exempts Woo,startsWithavoids touching unrelated names,parent_layer_namelanded in the same commit as the composite name so there's no historical-data gap, and an empty result still falls through to the"<Type> #N"ordinal.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b91bdab. Went with your "only strip when the composite actually matches
parent + SEP" option, which resolves this greedy-dash case and the Copilot prefix-collision case in one check. The strip now matches the exact<parent> —prefix and slices just that — no character-class replace — so a label that begins with its own dash keeps it:Summer sale — -50% off->-50% off, not50% off.The separator is now a module constant
HOTSPOT_NAME_SEPARATOR = ' — 'with a comment pointing athotspotLayerManager.js:213, since that is the source of truth for the composite. Added two tests (leading-dash and prefix-collision); both fail on the old logic and pass now. 15/15 in the suite.