Fix DebounceInput with native DOM elements (ReferenceError)#6637
Fix DebounceInput with native DOM elements (ReferenceError)#6637masenf wants to merge 2 commits into
Conversation
DebounceInput.create passed the child's tag as a bare JS identifier in the element prop, so wrapping a native DOM element like rx.el.input compiled to element:input and crashed the page with "ReferenceError: input is not defined". Component._render already quotes global-scope tags; extract that logic into Component._get_tag_name() and use it for the element prop so native elements render as element:"input". https://claude.ai/code/session_01DDtiK8EdqxtjVFRuykh4hD
Merging this PR will not alter performance
Comparing Footnotes
|
Greptile SummaryThis PR fixes a
Confidence Score: 5/5Safe to merge; the change is a minimal, focused refactor of a single quoting path with no effect on unrelated components. The extracted No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "Add news fragments for #6637" | Re-trigger Greptile |
All Submissions:
Type of change
Changes To Core Features:
Description
Problem: When
rx.debounce_inputwraps native DOM elements (e.g.,rx.el.input,rx.el.textarea), the frontend raisesReferenceError: input is not definedbecause theelementprop was passed as a bare identifier instead of a string literal.Root Cause: The
DebounceInput.create()method was passingchild.alias or child.tagdirectly as a JavaScript expression. For native elements with no library, this resulted in unquoted identifiers likeinputinstead of the string literal"input".Solution:
_get_tag_name()method toComponentthat returns the tag name properly quoted as a string literal when it's a global scope element (native DOM tag with no library).DebounceInput.create()to usechild._get_tag_name()instead of manually constructing the tag reference."input"(string) while library components remain as identifiers likeRadixThemesTextField.Root.Test Coverage
test_debounce_input.py) that verifiesrx.debounce_inputcorrectly renders and handles nativeinputandtextareaelements with debouncing.test_debounce.py) covering both native element and library component children to ensure proper tag name handling.https://claude.ai/code/session_01DDtiK8EdqxtjVFRuykh4hD