chanzuckerberg / sci-components

2021 Science Design System Component Library
https://chanzuckerberg.github.io/sci-components/
MIT License
25 stars 7 forks source link

fix: implement add use client to all sds components #825

Closed masoudmanson closed 2 months ago

masoudmanson commented 3 months ago

Summary

All SDS Components Github issue: #814

We nee to add "use client"; in all SDS component files, so projects don’t have to do that manually themselves like here: https://github.com/czbiohub-sf/CZBSF-Metadata-Tracker-refactor/pull/82#discussion_r1684929746

masoudmanson commented 2 months ago

Thanks so much for adding this, @masoudmanson !

Sorry for just realizing this, but it seems like in this thread, we might be able to mark the exported modules with "use client" automagically by doing this in rollup config!

rollup/rollup#4699 (comment)

And if we ever need to selectively apply "use client" in just some files, there's a plugin for that now too πŸ˜„

rollup/rollup#4699 (comment)

OMG nooo 😯😱🀣 This is so embarrassing! I should have checked it myself! I thought we actually needed to add the directive on top of every single component 😬 Thank you for digging that up, it really makes a huge difference πŸ₯³πŸŽ‰πŸ€© I'll leave this PR here and create a new one with the rollup changes.

tihuan commented 2 months ago

Thanks so much for adding this, @masoudmanson ! Sorry for just realizing this, but it seems like in this thread, we might be able to mark the exported modules with "use client" automagically by doing this in rollup config! rollup/rollup#4699 (comment) And if we ever need to selectively apply "use client" in just some files, there's a plugin for that now too πŸ˜„ rollup/rollup#4699 (comment)

OMG nooo 😯😱🀣 This is so embarrassing! I should have checked it myself! I thought we actually needed to add the directive on top of every single component 😬 Thank you for digging that up, it really makes a huge difference πŸ₯³πŸŽ‰πŸ€© I'll leave this PR here and create a new one with the rollup changes.

Ahaha I thought we had to manually add it ourselves too, so I probably misled you πŸ˜† 🀦 !! Thanks so much for creating a new PR!! πŸ˜‚