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

Error when go back to root route(web_sys) #1100

Closed
jetli opened this issue Mar 5, 2020 · 6 comments
Closed

Error when go back to root route(web_sys) #1100

jetli opened this issue Mar 5, 2020 · 6 comments
Labels
A-yew-router Area: The yew-router crate bug

Comments

@jetli
Copy link
Contributor

jetli commented Mar 5, 2020

Describe the Bug
On home page, click a few sub routes and then click back button of browser to go back to home page, error occurs.

To Reproduce
Visit demo site: https://jetli.github.io/create-yew-app/, click About link on the top right corner, click back button of browser, error occurs

[Error] ERROR:yew_router::service -- Could not deserialize state string
	__cargo_web_snippet_4fd31c9e56d40b8642cf9e6f96fd6b570f355cea (static.77de5100.js:1219)
	(匿名函数) (static.77de5100.js:1590)
	wasm-stub
	<?>.wasm-function[web_logger::console::error::snippet::__cargo_web_snippet_4fd31c9e56d40b8642cf9e6f96fd6b570f355cea::__cargo_web_snippet_4fd31c9e56d40b8642cf9e6f96fd6b570f355cea::h5b50faacea4277b7]
	<?>.wasm-function[web_logger::console::error::snippet::__cargo_web_snippet_4fd31c9e56d40b8642cf9e6f96fd6b570f355cea::h3e67391e6def4f15]
	<?>.wasm-function[web_logger::console::error::snippet::hcebf4544ca96341e]
	<?>.wasm-function[web_logger::console::error::h6795d3532b8cae07]
	<?>.wasm-function[<web_logger::WebLogger as log::Log>::log::he0286cac0458b3a7]
	<?>.wasm-function[log::__private_api_log::h8b5631829de36bf2]
	<?>.wasm-function[yew_router::service::RouteService<STATE>::register_callback::{{closure}}::{{closure}}::h78069363d1cc2b2d]
	<?>.wasm-function[core::result::Result<T,E>::unwrap_or_else::h272bc9ab043cf519]
	<?>.wasm-function[yew_router::service::RouteService<STATE>::register_callback::{{closure}}::hdf1f1f25dd74a713]
	<?>.wasm-function[yew_router::service::RouteService<STATE>::register_callback::{{closure}}::h3e08b7858e727e96]
	<?>.wasm-function[<dyn core::ops::function::FnMut<(&A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h7a78561faf3ff67f]
	wasm-stub
	_dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7a78561faf3ff67f
	__wbg_adapter_26 (static.77de5100.js:1533:136)
	real (static.77de5100.js:2347)

Related Info

  • yew version: 0.13.0
  • yew-router version: 0.10.0
  • feature: web_sys
@jetli
Copy link
Contributor Author

jetli commented Mar 5, 2020

Related to register_callback
https://github.com/yewstack/yew_router/blob/60fe08a1d1baf4067058ab557fc8ea507c2ac018/src/service.rs#L107

state_string is constantly JsValue('null') or JsValue(null), and panic when it is JsValue(null) due to serde deserialize failure later.

@jetli jetli changed the title Panic when go back to root route Panic when go back to root route(web_sys) Mar 5, 2020
@hgzimmerman
Copy link
Member

Strange, I couldn't replicate the panic with the provided site, although, it does mention that deserializing state failed (which believe is caused by the problem described in the other issue you opened).

@jetli jetli changed the title Panic when go back to root route(web_sys) Error when go back to root route(web_sys) Mar 6, 2020
@jetli
Copy link
Contributor Author

jetli commented Mar 6, 2020

Yes, it's an error, not panic, I corrected title and description of this issue.

@hgzimmerman
Copy link
Member

So this is expected behavior (although it is annoying with the logspam). I do intend to implement a better system in the near future. I've restarted work on yewstack/yew_router#218, which is the PR where it will be fixed, but I'm realizing that its going to be a pretty big breaking change and its going to take a while.

@jetli
Copy link
Contributor Author

jetli commented Mar 10, 2020

I didn't notice this error before, so I think this might be introduced after web-sys support.

@jstarry jstarry transferred this issue from yewstack/yew_router Apr 20, 2020
@jstarry jstarry added bug A-yew-router Area: The yew-router crate labels Apr 20, 2020
@siku2
Copy link
Member

siku2 commented May 18, 2021

No longer relevant with #1791.

@siku2 siku2 closed this as completed May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew-router Area: The yew-router crate bug
Projects
None yet
Development

No branches or pull requests

4 participants