Skip to content

Fix router example.#2179

Merged
ranile merged 3 commits into
yewstack:masterfrom
futursolo:fix-router-example
Nov 22, 2021
Merged

Fix router example.#2179
ranile merged 3 commits into
yewstack:masterfrom
futursolo:fix-router-example

Conversation

@futursolo
Copy link
Copy Markdown
Member

Description

This PR fixes re-render issue where the direct descent of a <Router> component is not re-rendered when it's children changes.

Fixes #2168

Checklist

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

@mc1098 mc1098 added the A-examples Area: The examples label Nov 22, 2021
voidpumpkin
voidpumpkin previously approved these changes Nov 22, 2021
Copy link
Copy Markdown
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.

Small optional nit-pick.
Otherwise LGTM

Comment thread packages/yew-router/src/router.rs Outdated
Comment thread packages/yew-router/src/router.rs
Comment thread packages/yew-router/src/router.rs Outdated
Comment thread packages/yew-router/src/router.rs Outdated
voidpumpkin
voidpumpkin previously approved these changes Nov 22, 2021
Comment thread packages/yew-router/src/router.rs Outdated
Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>
Copy link
Copy Markdown
Member

@ranile ranile left a comment

Choose a reason for hiding this comment

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

Looks good.

Why do the router state and action need to be pub(crate) instead of just being private? Are they used anywhere else?

@futursolo
Copy link
Copy Markdown
Member Author

futursolo commented Nov 22, 2021

Looks good.

Why do the router state and action need to be pub(crate) instead of just being private? Are they used anywhere else?

Router state is also used in the following files:

https://github.com/yewstack/yew/blob/master/packages/yew-router/src/scope_ext.rs#L91

https://github.com/yewstack/yew/blob/master/packages/yew-router/src/hooks.rs#L11

@futursolo
Copy link
Copy Markdown
Member Author

Action is due to it being an associated type of the reducible trait so it requires the same visibility as router state.

@ranile ranile merged commit e92eaed into yewstack:master Nov 22, 2021
@futursolo futursolo deleted the fix-router-example branch January 27, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-examples Area: The examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yew router example main.rs component does not update html at all

5 participants