Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

First render - unneccasary history.pushState #51

Closed
@tomatau

Description

@tomatau

On first page render, if redux DebugPanel is displayed, the simple router calls history.pushState with the existing route. This means that Router.createElement is invoked twice on ReactRouter - which isn't necessary.

The redux DevTools or perhaps LogMonitor seems to trigger the store.subrscribe callback on an interval. Here, RSR is finding that lastChangeId !== routing.changeId; and so calling the new pushState.

It could be worth caching the routePath and checking for a difference with the current getState().routing.path before invoking updatePath, but of course, that wouldn't take into account any route state changes.

It may be more simple to initialise the lastChangeId to the same value as initialState.changeId - again, there's probably a use case in here somewhere that route.state updates on initial render wouldn't be taken into account...

Perhaps #50 could prevent the unnecessary pushState call on initial render.

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