Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route not found not handled properly #33

Closed
AFaugeras opened this issue Oct 11, 2018 · 1 comment
Closed

route not found not handled properly #33

AFaugeras opened this issue Oct 11, 2018 · 1 comment

Comments

@AFaugeras
Copy link

versions:

"@k-redux-router/core": "^0.4.6",
"@k-redux-router/react-k-ramel": "^0.4.6",

when heading to an undefined route, the app just crash, with this error:

Uncaught TypeError: Cannot read property 'code' of undefined
    at o.i.toShow (index.es.js:1)
    at o.value (index.es.js:1)
    at callComponentWillMount (react-dom.development.js:11829)
    at mountClassInstance (react-dom.development.js:11917)
    at updateClassComponent (react-dom.development.js:13492)
    at beginWork (react-dom.development.js:14090)
    at performUnitOfWork (react-dom.development.js:16416)
    at workLoop (react-dom.development.js:16454)
    at HTMLUnknownElement.callCallback (react-dom.development.js:145)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:195)
    at invokeGuardedCallback (react-dom.development.js:248)
    at replayUnitOfWork (react-dom.development.js:15745)
    at renderRoot (react-dom.development.js:16548)
    at performWorkOnRoot (react-dom.development.js:17387)
    at performWork (react-dom.development.js:17295)
    at performSyncWork (react-dom.development.js:17267)
    at requestWork (react-dom.development.js:17155)
    at scheduleWork (react-dom.development.js:16949)
    at scheduleRootUpdate (react-dom.development.js:17637)
    at updateContainerAtExpirationTime (react-dom.development.js:17664)
    at updateContainer (react-dom.development.js:17691)
    at ReactRoot../node_modules/react-dom/cjs/react-dom.development.js.ReactRoot.render (react-dom.development.js:17957)
    at react-dom.development.js:18097
    at unbatchedUpdates (react-dom.development.js:17518)
    at legacyRenderSubtreeIntoContainer (react-dom.development.js:18093)
    at Object.render (react-dom.development.js:18152)
    at Object../src/index.js (index.js:7)
    at __webpack_require__ (bootstrap faccf88ca4ced995451f:678)
    at fn (bootstrap faccf88ca4ced995451f:88)
    at Object.0 (akf.woff?4i0mvx:1)
    at __webpack_require__ (bootstrap faccf88ca4ced995451f:678)
    at ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.module.exports (bootstrap faccf88ca4ced995451f:724)
    at bootstrap faccf88ca4ced995451f:724

router definition used:

import { router } from '@k-redux-router/react-k-ramel'

const routes = {
  '/': {
    code: 'HOME',
    '/todos': {
      code: 'TODOS',
      '/add': {
        code: 'TODO_ADD',
      },
    },
  },
}

export default router({
  routes,
  state: 'ui.router',
  getState: state => state.ui.router,
})

is there some configuration missing?
it would be very nice to fire an action when a route is not found, so that we could add some reaction to redirect to a dedicated 404 page :)

@fabienjuif
Copy link
Member

You are right.
Your code is alright.

Related to: #14

Feel free to reopen issue if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants