async-props icon indicating copy to clipboard operation
async-props copied to clipboard

fix for state not updating on route change

Open zackify opened this issue 8 years ago • 12 comments

Turns out, this was the problem. When the route changes, the update is not being forced. Also removed RoutingContext from the readme for you.

zackify avatar Jan 13 '16 22:01 zackify

:+1: :+1: :+1:

ChiefORZ avatar Jan 14 '16 08:01 ChiefORZ

@ryanflorence really hoping to get this merged and pushed up, I would rather not have to use a fork of this for a work demo :)

zackify avatar Jan 14 '16 14:01 zackify

This will also fix that annoying "RoutingContext has been renamed to RouterContext."-warning - would really love to see this merged soon :+1:

rexxars avatar Jan 18 '16 11:01 rexxars

@rexxars @ChiefORZ I needed this and a few other unmerged PR's so I forked it and published to npm with all the latest code: https://github.com/NavJobs/async-props

zackify avatar Jan 18 '16 16:01 zackify

Thanks @zackify!

quicksnap avatar Feb 16 '16 05:02 quicksnap

what does this fix?

ryanflorence avatar Mar 08 '16 07:03 ryanflorence

quick history on force.

If you click on a link, and then click on another link before the async props are done we could have two requests (or more) that are inflight simultaneously.

Imagine the props for the first request are slower than the props for the second. In these scenarios the first props land last, and then would callback and cause problems. So there's a check that the location is the same as when the request started, if the location has changed, we just ignore the data that comes back.

This change puts the race condition right back into the app.

So what exactly is this fixing?

ryanflorence avatar Mar 08 '16 07:03 ryanflorence

It's been a while now. But switching pages was just not working. Nothing would happen. Can't remember if this was due to the way routes were setup but it was obviously not doing an update on route change and a few other people noticed this too. Wish I could remember exactly what was happening... On Tue, Mar 8, 2016 at 02:28 Ryan Florence [email protected] wrote:

quick history on force.

If you click on a link, and then click on another link before the async props are done we could have two requests (or more) that are inflight simultaneously.

Imagine the props for the first request are slower than the props for the second. In these scenarios the first props land last, and then would callback and cause problems. So there's a check that the location is the same as when the request started, if the location has changed, we just ignore the data that comes back.

This change puts the race condition right back into the app.

So what exactly is this fixing?

— Reply to this email directly or view it on GitHub https://github.com/ryanflorence/async-props/pull/40#issuecomment-193644144 .

zackify avatar Mar 08 '16 14:03 zackify

My Issue #34 describes it in a way...Instant Callbacks - or Routes where no Props are needed - were not loading at all... Nothing happened.

ChiefORZ avatar Mar 08 '16 20:03 ChiefORZ

Can you folks try out 0.3.0 and see if it's still buggy in your app?

ryanflorence avatar Mar 10 '16 01:03 ryanflorence

@ryanflorence so far so good, 0.3.0 is awesome! Don't need my fork anymore :D

zackify avatar Mar 10 '16 17:03 zackify

We will update soon.. appreciate you cutting a new release--thanks @ryanflorence!

quicksnap avatar Mar 10 '16 21:03 quicksnap