ENG-9676 fix: route memo RestProp CSS props into css instead of dropping them#6605
ENG-9676 fix: route memo RestProp CSS props into css instead of dropping them#6605FarhanAliRaza wants to merge 2 commits into
Conversation
A `rx.RestProp` only forwarded kwargs that matched a declared field of the target component; any other forwarded prop (e.g. `font_weight`) was emitted as a raw plain prop the target silently ignored. Track each RestProp target's field names during body evaluation so the call site can fold non-field props into emotion `css`, matching how a normal component handles unknown kwargs.
Greptile SummaryFixes a silent data-loss bug where
Confidence Score: 4/5Safe to merge; the fix addresses a real silent-drop bug with a well-scoped, well-tested implementation and no regressions on common paths. The core routing logic is correct: the shared-set mutation pattern for the lazy body, the field-vs-CSS classification, and the emotion formatting path all behave as intended. Two edge cases lack test coverage — The Important Files Changed
|
| if css: | ||
| rest["css"] = LiteralVar.create( | ||
| convert_dict_to_style_and_format_emotion(css) | ||
| ) |
There was a problem hiding this comment.
convert_dict_to_style_and_format_emotion can return None
format_as_emotion returns None when its internal emotion_style dict ends up empty after processing (e.g. all entries are filtered or a Var-only style resolves to nothing). Passing None to LiteralVar.create would produce a css={null} prop in the JSX output, which silently drops all emotion styles at runtime. The if css: guard only checks the pre-conversion dict, not the output. A None check on the result would make this safe.
Adds the 6605 bugfix changelog entry documenting that `@rx.memo` forwards undeclared RestProp kwargs into `css`, and regenerates the memo.pyi hash.
A
rx.RestProponly forwarded kwargs that matched a declared field of the target component; any other forwarded prop (e.g.font_weight) was emitted as a raw plain prop the target silently ignored. Track each RestProp target's field names during body evaluation so the call site can fold non-field props into emotioncss, matching how a normal component handles unknown kwargs.All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features:
fixes @rx.memo with rx.RestProp doesn't handle CSS props correctly #6599