We have a screen controller to fetch components dynamic based on url. Before we wrote this:
[
{
path: '(.*)',
component: ScreenController,
options: {
// ... some options
},
},
]
After update we get some problems so we’re try to use async routes:
[
{
path: '(.*)',
async(context) {
const { to, resolve } = context;
resolve(
{ component: ScreenController },
{ props: { routePath: to.path } },
);
},
},
];
And it works fine. But if we reload page or go to url directly then values “to” and “from” swaped.
Live demo: https://codesandbox.io/s/reverent-euclid-d7knw?file=/src/App.js
Just click some items and reload page and compare url with console output.