Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

@@router/LOCATION_CHANGE events fired off multiple times on page load #43

Open
ardok opened this issue Feb 14, 2019 · 2 comments
Open

Comments

@ardok
Copy link

ardok commented Feb 14, 2019

Event @@router/LOCATION_CHANGE gets fired off 4x on page load. Looked around online and it seems like there's nothing mentioning this issue.

Type of issue

Bug?

Description

@@router/LOCATION_CHANGE action should get fired once on page load.

Current behavior

@@router/LOCATION_CHANGE action gets fired 4x on page load.
image

They all have the same exact payload.

{
  type: '@@router/LOCATION_CHANGE',
  payload: {
    location: {
      pathname: '/',
      search: '',
      hash: ''
    },
    action: 'POP',
    isFirstRendering: false
  }
}

Expected behavior

There should only be one @@router/LOCATION_CHANGE

Steps to reproduce

  1. Follow the README to install this plugin on your Fusion app
  2. Load a page.

Your environment

  • fusion-plugin-connected-react-router version: 1.1.1

  • Node.js version (node --version): 8.11.3

  • npm version (npm --version): 5.6.0

  • Operating System: macOS Mojave 10.14.3

@ardok
Copy link
Author

ardok commented Feb 15, 2019

I tried setting up connected-react-router from fresh app using create-react-app, and it's properly firing @@router/LOCATION_CHANGE only once.

image

{
  type: '@@router/LOCATION_CHANGE',
  payload: {
    location: {
      pathname: '/fy18/Phase-4/TASK-40234',
      search: '',
      hash: ''
    },
    action: 'POP',
    isFirstRendering: false
  }
}

So, this must be something to do with Fusion, or the way I set it up.
Could you think of any reason that could cause the action getting fired 4x on page load?

@ganemone
Copy link
Contributor

This plugin isn't super well supported right now. It was built as a proof of concept. I recommend keeping routing logic separate from the redux store and using the withRouter hoc to get access to routing related props.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants