-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I used this package to replace react-proxy-loader. While willTransitionTo
is working great, willTransitionFrom
never triggers.
The "component" being sent to willTransitionFrom appears to be the proxy component, and thus always fails the component.willTransitionFrom check:
https://github.com/odysseyscience/react-router-proxy-loader/blob/master/index.js#L34
' willTransitionFrom: function(transition, component, callback) {',
' if (component && component.willTransitionFrom) {',
' component.willTransitionFrom(transition, component, callback);',
I added component = component.state.component;
to the first line of the function above, and it does trigger willTransitionFrom on the dynamically loaded component. However, since component.state.component is the React class definition, and not the instance, I don't have access to the component state as documented by react-router below:
willTransitionFrom(transition, component, callback)
Called when an active route is being transitioned out giving you an opportunity to abort the transition. The component is the current component, you'll probably need it to check its state to decide if you want to allow the transition (like form fields).
Is there a way to make willTransitionFrom trigger with the proper component instance?
Any guidance would be appreciated. Thanks!