Skip to content

Commit c118552

Browse files
committed
fix double render issue
1 parent c60475a commit c118552

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"Bash(pnpm:*)",
1212
"Bash(ls:*)",
1313
"Bash(lerna list:*)",
14-
"Bash(npx lerna list:*)"
14+
"Bash(npx lerna list:*)",
15+
"Bash(find:*)"
1516
],
1617
"deny": []
1718
}

packages/pstricks/src/lib/psgraph.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ const psgraph: any = {
447447
const x = this.x;
448448
const y = this.y;
449449

450-
div.innerHTML = this.text;
451450
div.className = 'math';
452451
div.style.visibility = 'hidden';
453452
div.style.position = 'absolute';
@@ -467,11 +466,13 @@ const psgraph: any = {
467466

468467
const mathJax = (window as any).MathJax;
469468
if (mathJax && mathJax.typesetPromise) {
469+
div.innerHTML = this.text;
470470
mathJax.typesetPromise([div]).then(done).catch((err: any) => {
471471
console.error('MathJax typesetting failed:', err);
472472
done();
473473
});
474474
} else {
475+
div.innerHTML = this.text;
475476
done();
476477
}
477478
},
@@ -571,6 +572,10 @@ const psgraph: any = {
571572
});
572573
}
573574

575+
// Clear existing rput elements to prevent duplication
576+
const existingRputElements = el.querySelectorAll('.math');
577+
existingRputElements.forEach((element: any) => element.remove());
578+
574579
this.plot.rput.forEach((rput: any) => {
575580
psgraph.rput.call(rput.data, el);
576581
});

0 commit comments

Comments
 (0)