Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundle chakra in window for CSR #4042

Merged
merged 5 commits into from
Oct 3, 2024
Merged

Conversation

adhami3310
Copy link
Member

No description provided.

@adhami3310
Copy link
Member Author

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

@Lendemor
Copy link
Collaborator

Lendemor commented Oct 2, 2024

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?

@adhami3310
Copy link
Member Author

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

@Lendemor
Copy link
Collaborator

Lendemor commented Oct 3, 2024

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.

@adhami3310
Copy link
Member Author

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
Copy link
Member Author

Currently one can do:

bundle_library(rc.button())

and that would bundle reflex chakra

Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so as i read it, it's still up to the developer to call rx.dynamic.bundle_library at module level (i.e. not dynamically), to have their libs included in the window?

@adhami3310
Copy link
Member Author

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 adhami3310 merged commit ad0827c into main Oct 3, 2024
39 checks passed
Kastier1 pushed a commit that referenced this pull request Oct 23, 2024
* bundle chakra in window for CSR

* remove repeated chakra ui reference

* use dynamically generated libraries

* remove js from it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants