Repository navigation
better-content 0.8.1
Fixed: ContentEditSpan duplicated content after an edit
With a renderValue that turns the stored string into markup, editing a field and clicking away showed the raw source text and the rendered output one after the other, and every further edit round-tripped through the doubled text.
stored: A **bold** claim
after blur: A **bolder** claimA bolder claim ← both
While the field is focused its text is written imperatively, so React holds no record of those nodes — it renders false for children and a layout effect puts the raw string in the DOM behind its back. On blur React goes from no children to the rendered value and appends, leaving the imperative text node in front of it. The element is now cleared before React renders into it.
Only reachable with a renderValue. The default identity renderer duplicated too, but of identical text, so it read as a stutter rather than as markup — which is likely why no test caught it. Two tests now cover a renderValue across focus/blur, including a second round trip.
Reproduced and verified under a real browser, not only jsdom, since this is a DOM reconciliation bug and jsdom simulates contentEditable.
No API change. ^0.8.0 already resolves this, so no create-better-content release is needed.
Thanks to the report from portfolio-2025.