Skip to content

Fix fullscreen markdown editor crash and stale-value bugs (#25) - #26

Merged
jzongker merged 1 commit into
mainfrom
fix/25-markdown-fullscreen-crash
Aug 21, 2026
Merged

Fix fullscreen markdown editor crash and stale-value bugs (#25)#26
jzongker merged 1 commit into
mainfrom
fix/25-markdown-fullscreen-crash

Conversation

@jzongker

Copy link
Copy Markdown
Contributor

Replaces PR #25 (not merged — kept the two real bugs it found, dropped the parts that made things worse).

Kept:

  • TRANSFORMERS.splice(0, 13) mutated the shared Lexical TRANSFORMERS export in place; slice fixes that.
  • A formatting-state check stringified a boolean (JSON.stringify(lastFormattingState === "{}") is always truthy); now compares the stringified state correctly.

Not carried over from #25: deleting MarkdownModal's value-sync effect while leaving useEffect(() => onChange(inputVal), [inputVal, onChange]) — that still fires on every render when the parent passes an unstable onChange. Instead, removed that effect entirely and call onChange directly from the TextField's own change handler, so it only fires on actual user edits and the parent's onChange identity no longer matters.

No B1App change needed — main's CreateEventModal already wires onChange to real setDescription state; the ref-only regression was specific to PR #519, which isn't being merged either.

Changeset included.

TRANSFORMERS.splice(0, 13) mutated the shared Lexical export in place
instead of copying it; slice fixes that. A formatting-state check
compared a boolean to the string "{}" and was always true; fixed to
compare the stringified state. MarkdownModal called onChange(inputVal)
from an effect keyed on [inputVal, onChange], firing on every render
whenever the parent passes a new onChange reference; onChange now
fires only from the TextField's own change handler, so it only
propagates actual user edits.
@jzongker
jzongker merged commit f003d00 into main Aug 21, 2026
1 check passed
@jzongker
jzongker deleted the fix/25-markdown-fullscreen-crash branch August 21, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant