faceyspacey/redux-first-router-demo

Nested `action` object in third param of `onBeforeChange`

BrendanFDMoore opened this issue · 3 comments

Hi @faceyspacey

First, thanks so much for this utility and example library. After letting it percolate in my brain sufficiently, the dev experience had been pretty smooth.

One hiccup I encountered was in checking against a permission model in onBeforeChange in the options to connectRoutes as seen in your example here:
https://github.com/faceyspacey/redux-first-router-demo/blob/master/src/options.js#L4
options_js__working_tree__ _rfr-demo

When I run the demo, the third parameter to onBeforeChange which I expect to be the navigation action is instead nested inside a wrapping object and combined with an extra prop:
rfr__fp

So, if I replace the third parameter to destructure action instead, everything works as expected.
eg: onBeforeChange: (dispatch, getState, { action }) => { ... }

Has there been a change here that needs updating in the demo/docs, or have I managed to introduce a bug in my instance/implementation?

Yea it's at the top of the readme. It's one of the small recent updates in the latest versions.

Ahh, so there is. (Ref: https://github.com/faceyspacey/redux-first-router/blob/rudy/README.md#L23 )

I definitely read all your notes before I dove in, but did not have the context to understand at that point, and apparently forgot about it. Makes sense now.

Thanks!

Tiny PR to correct this on the rudy branch: #31