TehShrike / abstract-state-router

The best way to structure a single-page webapp.
http://tehshrike.github.io/state-router-example
296 stars 26 forks source link

test: resolve redirect reloads parent #149

Open saibotsivad opened 2 years ago

saibotsivad commented 2 years ago

Based on a conversation in the Discord chat, I thought it might be helpful to document (via tests) some specific redirect behavior.

saibotsivad commented 2 years ago

The second test that I added, I believe it should be passing as-is.

If I added a console log at the top of each resolve, like console.log(resolvedCount, stateName, params) then I would expect output like this:

0, app, {}
// first redirect to app.child
1, app, {}
2, app.child, {}
// second redirect to app.child.node with params
3, app, { anyKey: 'yes' }
4, app.child, { anyKey: 'yes' }
5, app.child.node, { anyKey: 'yes' }

But the actual output when I run it is like this:

0, app, {}
// first redirect to app.child
1, app, {}
2, app.child, {}

So it runs the resolve for app.child but doesn't finish redirecting to the app.child.node resolve, which I believe is incorrect behaviour.