Skip to content

Router renders components twice with hash history #148

Open
@wmaurer

Description

@wmaurer

With HTML5 History API, the user agent fires a popstate event when the user navigates through their history, whether backwards or forwards, provided it isn’t taking the user away from the current page:
http://html5doctor.com/history-api/#historical-events

As far as I understand it, this means that when using hash history - createHashHistory(), both a PUSH and a POP emitted.

@cycle/history also emits both of these events. You can see this by adding a debug to history$ in RouterSource, e.g. on line 39 of RouterSource.ts (when using the hash history).

However I believe it should be up to cyclic-router to filter out the POPs. The unfortunate consequence of getting both events is that components are rendered twice on every route change (when using hash history).

What do you think @TylorS?

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