mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #606] [MERGED] fix(core): guard MarkdownRenderable.getStyle against undefined syntaxStyle #1434
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#1434
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/606
Author: @cevr
Created: 2/1/2026
Status: ✅ Merged
Merged: 2/2/2026
Merged by: @kommander
Base:
main← Head:fix/markdown-getStyle-guard📝 Commits (1)
3aea717fix(core): guard MarkdownRenderable.getStyle against undefined syntaxStyle📊 Changes
1 file changed (+4 additions, -0 deletions)
View changed files
📝
packages/core/src/renderables/Markdown.ts(+4 -0)📄 Description
Summary
MarkdownRenderable.getStyle()against_syntaxStylebeing undefined when the Solid reconciler setscontentbeforesyntaxStyleProblem
The
@opentui/solidreconciler creates elements withnew Element(ctx, { id })— only{ id }is passed in constructor options. Props are then applied via setters in JSX declaration order.When a consumer writes:
The
contentsetter fires first, triggeringupdateBlocks()→createChunk()→getStyle(), which accessesthis._syntaxStyle— stillundefinedbecause thesyntaxStylesetter hasn't run yet.This crashes with:
Note
There's an existing branch
fix(solid)-prop-initialization-before-insertthat attempts to fix this at the Solid/babel level. This PR takes a complementary approach — defensive guard inMarkdownRenderableitself, so the component is resilient regardless of prop order.Fix
undefinedfromgetStyle()when_syntaxStyleis uninitializedsyntaxStylesetter runs,_styleDirtytriggersrerenderBlocks()on the next render cycle with correct stylesTest plan
<markdown content={...} syntaxStyle={...} />)Markdown.ts)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.