Skip to content

Commit 893be71

Browse files
committed
fix(ui): improve changes formatting with single-quoted identifiers
1 parent 0c62149 commit 893be71

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/web/app/src/components/target/history/errors-and-changes.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ import { CheckCircledIcon, InfoCircledIcon } from '@radix-ui/react-icons';
3131
import { Link } from '@tanstack/react-router';
3232

3333
export function labelize(message: string) {
34-
// Turn " into '
35-
// Replace '...' with <Label>...</Label>
36-
return reactStringReplace(message.replace(/"/g, "'"), /'([^']+)'/gim, (match, i) => {
37-
return <Label key={i}>{match}</Label>;
38-
});
34+
// Replace '...' and "..." with <Label>...</Label>
35+
return reactStringReplace(
36+
message,
37+
/["']([A-Za-z_$][A-Za-z0-9_.$@-]*(?:\.[A-Za-z_$][A-Za-z0-9_.$@-]*)?)["']/g,
38+
(match, i) => <Label key={i}>{match}</Label>,
39+
);
3940
}
4041

4142
const severityLevelMapping = {

0 commit comments

Comments
 (0)