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

refactor!: make widget composable by allowing children #52

Merged
merged 5 commits into from
Feb 6, 2024

Conversation

maartenbreddels
Copy link
Contributor

@maartenbreddels maartenbreddels commented Dec 27, 2023

BREAKING CHANGE: this is a breaking change because of renaming set_value to setValue on the frontend side.

This commit makes several changes, instead of having a single ReactWidget we now have a Widget (with no default value trait) and a ValueWidget (with a default value trait).

Furthermore, by specificing _module and _type instead of _esm we can now render any React component from any ES module, or even standard html components like

or .

The main (wrapper) component is now created in the model, which makes it easier to obtain the components of children. Once the main wrapper component is created, the while children tree is also resolved, and a synchroneous render can be made in one go.

TODO

  • update docs
  • avoid rendering twice by passing a ref down the component tree (and children) so that the root view can be passed down to the save_changes (needed for the print output to go to the right notebook cell)

BREAKING CHANGE: this is a breaking change because of renaming
set_value to setValue on the frontend side.

This commit makes several changes, instead of having a single
ReactWidget we now have a Widget (with no default value trait)
and a ValueWidget (with a default value trait).

Furthermore, by specificing _module and _type instead of _esm
we can now render any React component from any ES module,
or even standard html components like <div> or <span>.

The main (wrapper) component is now created in the model, which
makes it easier to obtain the components of children. Once the
main wrapper component is created, the while children tree is also
resolved, and a synchroneous render can be made in one go.
@maartenbreddels maartenbreddels marked this pull request as ready for review February 2, 2024 15:09
@maartenbreddels maartenbreddels merged commit eb18699 into master Feb 6, 2024
11 checks passed
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.

1 participant