When jsxStyleProps=none
, components from styled-system/jsx
are recreated on every render
#2632
Closed
1 of 3 tasks
Description
Hi 👋🏻 Thank you for this amazing library!
I noticed a sneaky bug related to the
styled-system/jsx
components such asStack
where the component gets recreated on every render due to the creation of an innerstyled()
component.Below I've copied the generated code for
Stack
where I've marked the potential cause for this bug:This is generally a bad practice in React as we should not be creating components within components because it will cause hard to detect issues with state, focus, etc. that can be seen in the provided CodeSandbox repro where the input within
Stack
loses focus on every keystroke while typing to the input.Link to Reproduction
https://codesandbox.io/p/sandbox/panda-css-repro-6gq83k
Steps to reproduce
JS Framework
React (TS)
Panda CSS Version
0.39.2
Browser
Google Chrome 124
Operating System
Additional Information
Not sure what is the best way to solve this but I've created a temporary version of
Stack
myself to get around this issue:This version doesn't support responsive props which would be nice to add but I'm not sure how to do that 😅
The text was updated successfully, but these errors were encountered: