Skip to content

Rework view_to_component #98

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

Merged
merged 22 commits into from
Oct 14, 2022

Conversation

Archmonger
Copy link
Contributor

@Archmonger Archmonger commented Sep 22, 2022

Description (NEW)

This PR reworks view_to_component to prevent needing to constantly pass in frequently used parameters.

Description (OLD)

In Conreq, I am relying on several view_to_component URLs to exist prior to the first render. That meaning, the compatibility registration needs to occur prior to the component's first time rendering.

By moving the iframe registration outside of the hook, this change allows me to arbitrarily call view_to_component(my_view, compatibility=True) as a "preloading" step during Conreq initialization to ensure the URL exists beforehand.

Additionally, a nice benefit of this is now type hints will work. They were previously obfuscated due to the @component decorator.

In my opinion, this feels less obtrusive than a separate API just to register iframes.

Checklist:

Please update this checklist as you complete each item:

  • Tests have been included for all bug fixes or added functionality.
  • The changelog.rst has been updated with any significant changes, if necessary.
  • GitHub Issues which may be closed by this PR have been linked.

@Archmonger Archmonger marked this pull request as draft September 22, 2022 00:32
@Archmonger Archmonger marked this pull request as ready for review September 22, 2022 02:05
@Archmonger Archmonger requested a review from rmorshea September 22, 2022 02:05
@Archmonger Archmonger changed the title Pre-register view_to_component URLs Rework view_to_component Oct 13, 2022
@Archmonger Archmonger merged commit 6f49037 into reactive-python:main Oct 14, 2022
@Archmonger Archmonger deleted the vtc-compat-registration branch October 14, 2022 22:44
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.

2 participants