fix: retain completed results during live editing
This commit is contained in:
@@ -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 ? (
|
||||
|
||||
Reference in New Issue
Block a user