Skip to content

Router is called twice on chromium-based browsers after refresh (F5) #262

@mprevel

Description

@mprevel

Hi,

It seems that the router is called twice after refreshing (F5) a page on chromium-based browsers (reproduced with chromium, chrome and brave on linux, but behaves as expected with Firefox).
It implies a duplication of the messages and commands that may be produced by the update function that handles the message from the router.

Adding a println allows to highlight the behavior.

  val routes: Location => Msg = {
    case loc: Location.Internal =>
      println(s"Router Internal Location: $loc")
      loc.hash.getOrElse("#/").drop(1) match
        case "/"               => Msg.NavigateTo(Page.Home)
        case _                 => Msg.NoOp
      
    case loc: Location.External =>
      println(s"Router Location External: $loc")
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions