Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listenBefore broken in v3.0.2 #4561

Closed
pke opened this issue Feb 20, 2017 · 9 comments
Closed

listenBefore broken in v3.0.2 #4561

pke opened this issue Feb 20, 2017 · 9 comments

Comments

@pke
Copy link

pke commented Feb 20, 2017

Version

3.0.2

Steps to reproduce

Use a listenBefore and dispatch an action in that listener.
Have a componentWillReceiveProps that also dispatches an action.

Expected Behavior

In < 3.x.x the action sent by the listenBefore is emitted first, before the route transition and component update.

Actual Behavior

In 3.0.2 the action sent from listenBefore is dispatched only after the transition happened.

Using the exact same branch, just reverting back to 2.8.1 makes everything work again as expected.

@pke pke changed the title beforeListener broken in v3.0.2 listenBefore broken in v3.0.2 Feb 20, 2017
@mjackson
Copy link
Member

What changed between 2.8.1 and 3.0.2? Any idea?

I've spent all my time recently working on v4, and I don't plan on digging back into v3 any time soon. So if you can help us figure out what changed that's breaking your app and fix it, that'd be great.

@mjackson mjackson added the v3 label Feb 20, 2017
@pke
Copy link
Author

pke commented Feb 20, 2017

maybe it nothing in react-router but an update of the history package it uses internally?
Seems there was a change in #3647

@timdorr
Copy link
Member

timdorr commented Feb 20, 2017

listenbefore comes directly from history. And the 3.x version of history is a rewrite from the previous 2.x version. Sounds like a history bug to me.

@mjackson
Copy link
Member

Well, the history issue tracker is full of v3 bugs, most of which are being reported by people who are trying to use the router with history. If we stop using history v3 in the router, I bet nobody will care about those bugs anymore, because nobody will use history v3.

Can we update router v3 to just use history v4? All the same functionality should be there, and it seems like history v4 is fairly solid.

@mjackson
Copy link
Member

Also, from #3647

This code isn't going to win any beauty awards.

😞

@ryanflorence
Copy link
Member

History v3 does all that query parsing and stuff right? Would have to add that in.

@mjackson
Copy link
Member

mjackson commented Mar 3, 2017

I'd recommend either downgrading to history 2.x or upgrading to history 4.x. It looks like history 3.x was just a bad release, done while I wasn't looking. My apologies for that, but I don't have the time to fix 3.x right now. By all accounts things are working perfectly in 4.x.

@mjackson mjackson closed this as completed Mar 3, 2017
@pke
Copy link
Author

pke commented Mar 3, 2017

However v4 doesn't support code splitting so elegantly anymore, does it?

@mjackson
Copy link
Member

mjackson commented Mar 3, 2017

@pke The story for code splitting in v4 is far more elegant than anything we've done previously. The router is just components now, so you can code split like you would with any other components.

If you need an example, see how we're doing it on the router docs website.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
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

4 participants