reflex icon indicating copy to clipboard operation
reflex copied to clipboard

bundle chakra in window for CSR

Open adhami3310 opened this issue 1 year ago β€’ 4 comments

adhami3310 avatar Oct 02 '24 21:10 adhami3310

Question for reviewers, this solution isn't very scalable, it would be better if there's a way to register what libraries are going to be in window

adhami3310 avatar Oct 02 '24 21:10 adhami3310

Question for reviewers, this solution isn't very scalable, it would be better if there's a way to register what libraries are going to be in window

How about providing an app method register_var_component to allow arbitrary CSR components rather than just the predefined ones?

Lendemor avatar Oct 02 '24 22:10 Lendemor

providing an app method register_var_component

well, it would need to happen at the library level (because we don't expect people to register every single component they are going to use), but that's a bit abstracted (we don't really mention radix much, so how would you figure out you have to write @radix-ui/themes

adhami3310 avatar Oct 02 '24 22:10 adhami3310

providing an app method register_var_component

well, it would need to happen at the library level (because we don't expect people to register every single component they are going to use), but that's a bit abstracted (we don't really mention radix much, so how would you figure out you have to write @radix-ui/themes

Well the core components could be "automatically" registered, while third party comp would have to be registered manually if they want them for dynamic rendering.

Ideally people don't need to know the actual name of the library, just passing the component to register would be enough to infer the library name.

Lendemor avatar Oct 03 '24 14:10 Lendemor

just passing the component to register would be enough to infer the library name

This works to an OK degree if it was only one component per library, but what should the pass then are using chakra? reflex_chakra?

adhami3310 avatar Oct 03 '24 17:10 adhami3310

Currently one can do:

bundle_library(rc.button())

and that would bundle reflex chakra

adhami3310 avatar Oct 03 '24 18:10 adhami3310

s still up to the developer to call rx.dynamic.bundle_library (...) to have their libs included in the window

yes, otherwise reflex wouldn't bundle the library in window

adhami3310 avatar Oct 03 '24 21:10 adhami3310