stitchesjs / stitches

[Not Actively Maintained] CSS-in-JS with near-zero runtime, SSR, multi-variant support, and a best-in-class developer experience.
https://stitches.dev
MIT License
7.75k stars 253 forks source link

Relevant props #1040

Open darklight9811 opened 2 years ago

darklight9811 commented 2 years ago

Is your feature request related to a problem? Please describe. As related to this issue on solid framework. Passing children to css method of stitches causes component to unnecessarily rerender.

Describe the solution you'd like The CSS method could return it's related dependencies like:

const wrapper = css({
  variants: {
    enabled: {
      true: {
        /* style here */
      }
    }
  }
})

// would be: ["css", "enabled"]
const dependencies = wrapper.dependencies

This would allow us to extract relevant props from being processed by stitches. Or internally stitches could cache relevant props so it would only use them.

Additional context This may be causing bugs in other frameworks/contexts not noticed by people too, solving issues people didn't even know they have.