fix(sessions): highlight every skill chip in submitted prompts#3271
Draft
adboio wants to merge 2 commits into
Draft
fix(sessions): highlight every skill chip in submitted prompts#3271adboio wants to merge 2 commits into
adboio wants to merge 2 commits into
Conversation
Submitted prompts flatten their <skill /> tags to plain /name text before the thread renders them, but the rendered-message chip parser only matched a slash command anchored to the very start of the string (a non-global `/^\/.../ ` used with a single `.match()`). Any second or later /skill fell through to plain text, so only the first skill in a multi-skill prompt got a chip — even though the live input box highlights them all. Scan for every slash command with a global, non-anchored regex and merge those matches with the existing mention-tag matches (sorted by position) so each /skill, file, folder, and GitHub ref renders its chip regardless of order. Generated-By: PostHog Code Task-Id: 26ac46b1-6c16-4112-ae2a-ddc60b56f1c0
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
The quality check runs `biome ci`, which includes formatting. Collapse the multi-line import in the new test to a single line so formatting passes. Generated-By: PostHog Code Task-Id: 26ac46b1-6c16-4112-ae2a-ddc60b56f1c0
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Reported in Slack: once a prompt is submitted, only the first skill in the prompt keeps its chip highlight — later skills render as plain text. In the input box, all of them are highlighted. This is a purely cosmetic inconsistency in how a submitted user message is rendered in the thread.
Changes
Submitted prompts flatten their
<skill … />tags to plain/nametext before the thread renders them, but the rendered-message chip parser (parseFileMentions.tsx) only matched a slash command anchored to the very start of the string (a non-global regex used with a single.match()). Any second-or-later/skillfell through to plain markdown.The parser now scans for every slash command with a global, non-anchored regex and merges those matches with the existing mention-tag matches (files, folders, GitHub refs, error context), sorted by position, so each chip renders regardless of order.
How did you test this?
Added
parseFileMentions.test.tsxcovering multiple slash commands, non-leading commands, mid-word slashes (not matched), and slash commands interleaved with file mentions. Ran:vitest run parseFileMentions— 6 passedvitest run UserMessage— 5 passed (existing suite still green)biome linton the changed files — cleanAutomatic notifications
Created with PostHog from a Slack thread