Skip to content

Commit 9c5cb77

Browse files
Andrei L. Magneaclaude
authored andcommitted
fix(list): avoid lookbehind regex in CTA copy split
The placeholder copy line-break used a lookbehind assertion `(?<=\.)`, which throws a SyntaxError when the regex literal is parsed on iOS Safari 16.3 and older, crashing the Lists page for those users. Swap it for a plain `". "` string split that reconstructs the sentence periods, keeping identical output with no lookbehind. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0d1205a commit 9c5cb77

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

projects/client/src/lib/sections/lists/components/cta/_internal/PlaceholderItem.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@
2121
2222
// Keep the first two (short) sentences on one row and the remainder on the
2323
// next. Locales that don't use ". " sentence breaks fall back to one line.
24+
// Plain string split avoids a lookbehind regex, which throws on iOS Safari
25+
// <= 16.3.
2426
const text = $derived.by(() => {
2527
const copy = intl.text({ cta });
26-
const sentences = copy.split(/(?<=\.)\s+/);
28+
const sentences = copy.split(". ");
2729
2830
if (sentences.length < 3) {
2931
return copy;
3032
}
3133
32-
const firstRow = sentences.slice(0, 2).join(" ");
33-
const secondRow = sentences.slice(2).join(" ");
34+
const firstRow = `${sentences.slice(0, 2).join(". ")}.`;
35+
const secondRow = sentences.slice(2).join(". ");
3436
3537
return `${firstRow}\n${secondRow}`;
3638
});

0 commit comments

Comments
 (0)