yewstack/yew_router

Lost history when refresh page(web_sys)

jetli opened this issue · 4 comments

jetli commented

Describe the Bug
Navigate a few routes, and refresh the page, the whole route history is lost, back button of browser is disabled. Seems push state history is not properly stored and restored.

Related Info

  • yew version: 0.13.0
  • yew-router version: 0.10.0
  • feature: web_sys
jetli commented

Related to set_route?

pub fn set_route(&mut self, route: &str, state: STATE) {

state_string seems always be null, after I add some logs.

Strange. Is this using the non-default type parameter for the Route's STATE? I know that the default () tends to cause problems serializing and deserializing, and that might be the source of the problem.

The most likely fix would be to declare an empty struct that implements the required traits to be STATE and use that in place of () as the default parameter.

I'm still confused as to why this is happening on web_sys only at the moment though :/

jetli commented

I haven't tried stdweb yet, not sure whether this is happening on stdweb.

jetli commented

I cannot reproduce this now, close this issue for now.