fix: retain completed results during live editing

This commit is contained in:
2026-07-27 13:05:02 +02:00
parent 7f3a91ad37
commit d2e9b3b569
22 changed files with 576 additions and 117 deletions

View File

@@ -8,6 +8,7 @@ export interface ExplanationTreeProps {
readonly root?: NormalizedRegexNode;
readonly selectedId?: string;
readonly flags?: readonly string[];
readonly stale?: boolean;
readonly onSelect: (node: NormalizedRegexNode) => void;
}
@@ -165,6 +166,7 @@ export function ExplanationTree({
root,
selectedId,
flags = [],
stale = false,
onSelect,
}: ExplanationTreeProps) {
const totalNodes = useMemo(() => (root ? countNodes(root) : 0), [root]);
@@ -191,8 +193,18 @@ export function ExplanationTree({
<p className="eyebrow">Pattern structure</p>
<h2 id="explanation-heading">Explanation tree</h2>
</div>
<span className="provenance-badge">
Deterministic · syntax provider
<span
className={`provenance-badge ${stale ? "is-stale" : ""}`}
data-testid={stale ? "stale-pattern-syntax" : undefined}
title={
stale
? "This is the last parsed pattern. Its ranges are not applied to the current editor."
: undefined
}
>
{stale
? "Stale snapshot · checking current pattern"
: "Deterministic · syntax provider"}
</span>
</header>
{totalNodes > renderedNodes ? (