altjs / router

Connect react-router to alt so you can have routes in flux
29 stars 3 forks source link

AltRouter listens to history in a weird way #6

Closed taion closed 8 years ago

taion commented 9 years ago

https://github.com/altjs/router/blob/v1.2.0/src/AltRouter.js#L105

cf https://github.com/rackt/react-router/issues/2502

This history.listen listens to the "raw" history, and fires when the user initiates a transaction, and fires with the new location.

I behaves quite differently from calling history.listen on the wrapped history that the RoutingContext exports on context - that one invokes the callback with router errors and router state (params, routes, &c.), and in the case of async routes only fires after the transition fully completes (i.e. potentially after the callback set up above fires).

Not sure if this is intentional - seems odd at first glance.

taion commented 8 years ago

On second thought, this is fine, and it's consistent with redux-simple-router.

goatslacker commented 8 years ago

I was keeping this open in case this popped up. I have had an SPA running with alt + alt-router for the past few months and was keeping an eye out on this.

Thanks for closing though :)