Skip to content

docs: tutorial: update outdated fetching data section#4141

Merged
Madoshakalaka merged 21 commits into
yewstack:masterfrom
shan-shaji:fix/shan/docs/4083
Jun 7, 2026
Merged

docs: tutorial: update outdated fetching data section#4141
Madoshakalaka merged 21 commits into
yewstack:masterfrom
shan-shaji:fix/shan/docs/4083

Conversation

@shan-shaji
Copy link
Copy Markdown
Contributor

@shan-shaji shan-shaji commented Apr 19, 2026

Description

Fetching data section of the tutorial page still mentioned using wasm-bindgen-futures::spawn_local. Updated the docs and examples to use yew::platform::spawn_local and the use_future hook instead.

note: for translation purpose I did used LLM (Codex | GPT-5.4)

Fixes #4083

Checklist

  • update next version docs.
  • update 0.22 version docs.
  • update 0.23 version docs.
  • final cleanup.
  • update translations.
  • I have reviewed my own code
  • I have added tests

Fetching data section of the tutorial page still mentioned using
`wasm-bindgen-futures::spawn_local`. Updated the docs and examples to use
`yew::platform::spawn_local` and the `use_future` hook instead.
…tions

The wasm-bindgen-futures was still present in the docs, so removed it.
Adding the delay to see the loading should have been a last section so
moved it to the end. Removed the path and populated the same with the
full link, as later in the docs to fix the cors issue we are asking the
user to replace the full link with the path.
@shan-shaji
Copy link
Copy Markdown
Contributor Author

shan-shaji commented Apr 29, 2026

Hi @Madoshakalaka , Could you please check english the version? If it looks good i can translate it into other languages.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

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

https://yew-rs--pr4141-fix-shan-docs-4083-9uv445ea.web.app

(expires Sun, 14 Jun 2026 03:36:47 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@Madoshakalaka
Copy link
Copy Markdown
Member

the App diff should also remove the stray if let block, since VideosFetcher is the new home for that rendering. In all three versions of index.mdx at the App-update code block, please add to the - lines:

  -       if let Some(video) = &*selected_video {
  -           <VideoDetails video={video.clone()} />
  -       }

and re-tune the highlight ranges accordingly.


you can touch yew/tools/website-test/build.rs && cargo test -p website-test and check the generated output at target/debug/build/website-test-12341234312/out/website_tests.rs

now if somebody follows our tutorial they will get:

  html! {
      <>
          <h1>{ "RustConf Explorer" }</h1>
          <Suspense fallback={html! {<p> {"Loading..."} </p>}} >
             <VideosFetcher … selected_video={(*selected_video).clone()} />
           </Suspense>
      </>
      if let Some(video) = &*selected_video {
          <VideoDetails video={video.clone()} />
      }
  }

with the video details rendered twice.

@shan-shaji
Copy link
Copy Markdown
Contributor Author

Ahh, thanks for catching that. I will update it.

@shan-shaji shan-shaji marked this pull request as ready for review June 6, 2026 22:13
@shan-shaji
Copy link
Copy Markdown
Contributor Author

shan-shaji commented Jun 6, 2026

HI @Madoshakalaka , sorry for the delay. I was busy with some uni things. The PR is ready for review now.

… gloo-net

- Normalize the `use_future`/`spawn_local` docs.rs links to each page's
  version (`latest` for next/current, `0.23.0`/`0.22.0` for the versioned
  docs and their translations) instead of hard-coding `0.23.0`/`latest`.
- Correct the Cargo.toml code-block highlight range `{2-6}` -> `{2-5}`
  (the block is only 5 lines).
- Bump the tutorial's `gloo-net` from `0.6` to `0.7`, matching the version
  the snippets are compiled against in `tools/website-test`.
Copy link
Copy Markdown
Member

@Madoshakalaka Madoshakalaka left a comment

Choose a reason for hiding this comment

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

sorry for the delay.

All good. I took the liberty of fixing some minor issues and pushed to your branch.

Will merge in a moment

@Madoshakalaka Madoshakalaka merged commit 47d4082 into yewstack:master Jun 7, 2026
5 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.

Yew.rs tutorial has outdated wasm-bindgen-futures pattern

2 participants