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

Remove start_app_as_body. #2346

Merged
merged 3 commits into from
Jan 10, 2022
Merged

Remove start_app_as_body. #2346

merged 3 commits into from
Jan 10, 2022

Conversation

futursolo
Copy link
Member

@futursolo futursolo commented Jan 8, 2022

Description

Fixes #2344

This Pull Request Removes _as_body variant of start_app Due to the following reasons:

  1. If body is created repeatedly, it can causes Yew router when pushing history breaks form submits #2344 where event listeners are not re-registered.
  2. It works poorly with the upcoming SSR hydration (Hydration makes an assumption that the first element in the root element is aligned to first VTag in the virtual dom.).

Checklist

  • I have run cargo make pr-flow
  • I have reviewed my own code
  • I have added tests

@ranile ranile enabled auto-merge (squash) January 9, 2022 10:46
ranile
ranile previously approved these changes Jan 9, 2022
@voidpumpkin voidpumpkin added the A-yew Area: The main yew crate label Jan 9, 2022
Copy link
Member

@voidpumpkin voidpumpkin left a comment

Choose a reason for hiding this comment

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

Could you add a note about this change in migration docs?

auto-merge was automatically disabled January 9, 2022 10:58

Head branch was pushed to by a user without write access

@github-actions
Copy link

github-actions bot commented Jan 9, 2022

Visit the preview URL for this PR (updated for commit a28a590):

https://yew-rs--pr2346-remove-as-body-h887e32t.web.app

(expires Sun, 16 Jan 2022 11:09:45 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Copy link
Member

@voidpumpkin voidpumpkin left a comment

Choose a reason for hiding this comment

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

Well looks good for me but I would like for @siku2 to take a look as well just in case.

@voidpumpkin voidpumpkin self-requested a review January 9, 2022 11:06
@@ -0,0 +1,8 @@
---
Copy link
Member

Choose a reason for hiding this comment

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

I realized this page is not added to the navigation bar. Could you add it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the migration guide should remain "hidden" until released, shouldn't it?

(This is the same as the yew-agent 0.1.0 -> 0.2.0 guide, which is hidden.)

Copy link
Member

Choose a reason for hiding this comment

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

Showing it would make 0.19 -> next transition easier but it's something we can do later.

Copy link
Member

Choose a reason for hiding this comment

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

you guys are right

Copy link
Member

@voidpumpkin voidpumpkin left a comment

Choose a reason for hiding this comment

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

Been long enough, if anything we can just implement this again in the future

@ranile ranile merged commit 1c367a7 into yewstack:master Jan 10, 2022
@futursolo futursolo deleted the remove-as-body branch January 27, 2022 13:59
@qieman
Copy link

qieman commented Nov 21, 2022

Hey, Is there any alternative to this method? i want to use start_app_as_body to set body css style.

@sam0x17
Copy link

sam0x17 commented Jan 23, 2023

Yes, what is the canonical way of doing this now? I need to set an attribute on body for css theme reasons and can't figure out how to do it

@futursolo
Copy link
Member Author

You can use gloo_utils::body().class_list().add_one("your-class").

If you wish to have body classes managed like start_app_as_body, you can use <Helmet /> from bounce.

If you wish to manage global styling, you can also use <Global /> from stylist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew Area: The main yew crate breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants