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

Prevents Fallback UI from becoming suspended #2532

Merged
merged 10 commits into from Mar 20, 2022

Conversation

futursolo
Copy link
Member

@futursolo futursolo commented Mar 20, 2022

Description

Originally part of #2453.

This pull request prevents Fallback UI from becoming suspended (this used to be an undefined behaviour where the last un-suspended UI of fallback would still be present.).

Checklist

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

# Conflicts:
#	.github/workflows/main-checks.yml
#	examples/agents/Cargo.toml
#	examples/boids/Cargo.toml
#	examples/contexts/Cargo.toml
#	examples/counter/Cargo.toml
#	examples/dyn_create_destroy_apps/Cargo.toml
#	examples/file_upload/Cargo.toml
#	examples/function_memory_game/Cargo.toml
#	examples/function_router/Cargo.toml
#	examples/function_router/index.html
#	examples/function_todomvc/Cargo.toml
#	examples/futures/Cargo.toml
#	examples/game_of_life/Cargo.toml
#	examples/inner_html/Cargo.toml
#	examples/js_callback/Cargo.toml
#	examples/keyed_list/Cargo.toml
#	examples/mount_point/Cargo.toml
#	examples/nested_list/Cargo.toml
#	examples/node_refs/Cargo.toml
#	examples/password_strength/Cargo.toml
#	examples/portals/Cargo.toml
#	examples/router/Cargo.toml
#	examples/suspense/Cargo.toml
#	examples/timer/Cargo.toml
#	examples/todomvc/Cargo.toml
#	examples/two_apps/Cargo.toml
#	examples/web_worker_fib/Cargo.toml
#	examples/webgl/Cargo.toml
#	packages/yew-router/Cargo.toml
#	packages/yew/Cargo.toml
#	packages/yew/Makefile.toml
#	packages/yew/src/app_handle.rs
#	packages/yew/src/dom_bundle/bcomp.rs
#	packages/yew/src/dom_bundle/mod.rs
#	packages/yew/src/dom_bundle/traits.rs
#	packages/yew/src/html/component/lifecycle.rs
#	packages/yew/src/html/component/mod.rs
#	packages/yew/src/html/component/scope.rs
#	packages/yew/src/html/mod.rs
#	packages/yew/src/lib.rs
#	packages/yew/src/renderer.rs
#	packages/yew/src/scheduler.rs
#	packages/yew/src/suspense/component.rs
#	packages/yew/src/virtual_dom/vcomp.rs
#	tools/website-test/Cargo.toml
#	website/docs/getting-started/build-a-sample-app.mdx
#	website/docs/tutorial/index.mdx
@futursolo futursolo added the A-yew Area: The main yew crate label Mar 20, 2022
github-actions[bot]
github-actions bot previously approved these changes Mar 20, 2022
@github-actions
Copy link

github-actions bot commented Mar 20, 2022

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

https://yew-rs-api--pr2532-base-suspense-txudc7o3.web.app

(expires Sun, 27 Mar 2022 05:58:58 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@github-actions
Copy link

github-actions bot commented Mar 20, 2022

Size Comparison

examples master (KB) pull request (KB) diff
boids 304.690 304.595 -0.096
contexts 218.827 217.709 -1.118
counter 157.766 157.687 -0.079
dyn_create_destroy_apps 166.455 166.176 -0.279
file_upload 187.320 187.256 -0.064
function_memory_game 344.659 344.588 -0.071
function_router 22.254 22.254 0
function_todomvc 320.487 320.395 -0.093
futures 355.903 356.007 +0.104
game_of_life 200.101 199.937 -0.164
inner_html 149.812 149.620 -0.192
js_callback 165.191 165.002 -0.189
keyed_list 322.457 322.361 -0.096
mount_point 157.106 156.794 -0.312
nested_list 218.762 218.416 -0.346
node_refs 164.352 164.282 -0.069
password_strength 1845.999 1845.914 -0.085
portals 171.551 170.833 -0.718
router 583.786 582.700 -1.086
suspense 206.096 215.878 +9.782
timer 163.583 163.490 -0.093
todomvc 263.862 263.836 -0.026
two_apps 159.250 159.090 -0.160
webgl 164.002 163.839 -0.163

@futursolo futursolo changed the title Prevents Fallback UI from becoming suspended + <Portal /> Prevents Fallback UI from becoming suspended Mar 20, 2022
Copy link
Member

@hamza1311 hamza1311 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +138 to +140
#[function_component]
pub fn Suspense(_props: &SuspenseProps) -> Html {
Html::default()
Copy link
Member

Choose a reason for hiding this comment

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

This is here to be replaced when SSR hydration is a thing, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a skeleton code for libraries when they don't have any renderer enabled (which means that they never gets rendered).

If we apply feature flags on the actual Suspense component multiple feature flags will be needed.

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 in the long term, it may be beneficial to separate rendering logic into a separate crate so we don't keep adding feature flags.

@futursolo futursolo merged commit b392023 into yewstack:master Mar 20, 2022
@futursolo futursolo deleted the base-suspense branch March 26, 2022 09:02
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants