Fix demo_form_dialog to omit trigger when not provided - #6940
Conversation
`demo_form_dialog` fell back to `rx.fragment()` when no trigger was
passed, so the base-ui `Dialog.Trigger` compiled to
`render:(jsx(Fragment, ({})))`. A Fragment cannot accept the props and
ref that base-ui forwards through the render prop, which makes React
complain in the console.
Match the pattern already used by the dialog, drawer, preview card, and
collapsible namespaces: render the trigger only when one is provided.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FcXXMZnAkNtwBj7v2bshXH
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Merging this PR will not alter performance
Comparing Footnotes
|
Greptile SummaryThe PR updates
Confidence Score: 4/5The PR should not merge until the outstanding import-order violation in the new test file is corrected so the lint gate passes. The functional fix is focused, but the new test file still has the import ordering reported in the prior thread, which violates the repository’s isort convention and is rejected or modified by the configured Ruff check. Files Needing Attention: tests/units/reflex_components_internal/blocks/test_demo_form.py
|
| Filename | Overview |
|---|---|
| packages/reflex-components-internal/src/reflex_components_internal/blocks/demo_form.py | Conditionally renders dialog.trigger so triggerless dialogs no longer create an empty Fragment render target. |
| tests/units/reflex_components_internal/blocks/test_demo_form.py | Adds focused trigger-rendering regression tests, but the outstanding import ordering causes the configured lint gate to reject or rewrite the file. |
Reviews (2): Last reviewed commit: "test(internal): assert the demo form tri..." | Re-trigger Greptile
`Book a Demo` is also the dialog's own heading, so the assertion passed even if the trigger's content were dropped. Use a label the dialog body never renders, and assert it is absent without a trigger so the test keeps guarding against a collision. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FcXXMZnAkNtwBj7v2bshXH
Type of change
Description
Fixed
demo_form_dialog()to properly handle the case when no trigger is provided. Previously, the function would create an emptyrx.fragment()as a fallback trigger, which caused React runtime warnings because Fragment components cannot receive the props and ref that base-ui's render prop forwards to them.Changes:
rx.fragment()fallback whentriggerisNonedialog.trigger()only when a trigger is explicitly providedTesting
tests/units/reflex_components_internal/blocks/test_demo_form.py:test_demo_form_dialog_omits_trigger_when_not_given(): Verifies that no trigger is rendered when none is providedtest_demo_form_dialog_renders_given_trigger(): Verifies that a provided trigger is properly renderedBoth tests pass and validate the fix works as intended.
https://claude.ai/code/session_01FcXXMZnAkNtwBj7v2bshXH