mksarge / redux-json-router

Declarative, Redux-first routing for React/Redux browser applications.
MIT License
36 stars 7 forks source link

Fallback to previous pathname if no match #12

Open lelandcope opened 5 years ago

lelandcope commented 5 years ago

Why does a route fallback to a previous pathname if no match is found? Shouldn't it fallback to the catch all route instead? Is there a way to force it to use the catch all route in these instances?

Example

Routes
  {
        path: '/docs',
        load: () => Promise.resolve(require('../components/Docs').default),
        children: [
            {
                path: '/:id',
                load: () => Promise.resolve(require('../components/ViewDoc').default),
                chunk: false
            }
        ]
    },
    {
        path: '*',
        load: () => new Promise((resolve, reject) => {
            try {
                require.ensure(['../components/404Page'], (require) => {
                    resolve(require('../components/404Page').default);
                });
            } catch (err) {
                reject(err);
            }
        })
    }
URL

If I go to /docs/22/ANYTHING_ELSE_HERE I would expect it to hit the catch all route defined above but instead it renders ViewDoc.

Is there a way to force it to the catch all error route?