fix: prevent KeyError on TextArea theme initialization (#6528)#6553
Open
marcos-dataops wants to merge 1 commit into
Open
fix: prevent KeyError on TextArea theme initialization (#6528)#6553marcos-dataops wants to merge 1 commit into
marcos-dataops wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for contributing!
This project requires all PRs to link to an issue or discussion. Ideally signed off by @willmcgugan
Link to issue or discussion
Closes #6528
Hey folks! Ran into a crash when throwing a
TextAreainside aModalScreen. It throws aKeyErrorlooking fortext-area--gutterin the component styles because it tries to render before the DOM has fully resolved the initial component classes.To fix this without breaking the render cycle, I just wrapped the
get_component_rich_stylecall insideapply_csswith a try/except. If the key isn't there yet, it safely falls back toNoneand continues smoothly.I also dropped a quick regression test in
test_issue_6528.pyto make sure we don't catch this crash again in the future.Let me know if you need any adjustments to this approach. Thanks!