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

Undefined vnode? #8

Open
austinjp opened this issue Oct 18, 2018 · 0 comments
Open

Undefined vnode? #8

austinjp opened this issue Oct 18, 2018 · 0 comments

Comments

@austinjp
Copy link

Hi.

I'm trying to wrap <LiquidRoute> in a custom component to handle authorisation:

  <Router>
    <AuthRoute>
      <LiquidRoute animator={FadeAnimation} path="/test" component={Test} />
    </AuthRoute>
  </Router>

AuthRoute looks like this:

import { h, Component } from "preact"
import { route } from "preact-router"
import { STORAGE_USER } from "../conf.js"

class AuthRoute extends Component {
  constructor() {
    super()
  }

  componentWillMount() {
    if (! localStorage.getItem(STORAGE_USER)) {
      route("/")
    }
  }

  render(props) {
    return (
        <div>{props.children}</div>
    )
  }
}

export default AuthRoute

This results in the following error in Firefox:

TypeError: vnode.attributes is undefined
rankChild
webpack-internal:///./node_modules/preact-router/dist/preact-router.es.js:86:2
prepareVNodeForRanking
webpack-internal:///./node_modules/preact-router/dist/preact-router.es.js:69:15
filter self-hosted:318:17 getMatchingChildren
webpack-internal:///./node_modules/preact-router/dist/preact-router.es.js:315:10
render
webpack-internal:///./node_modules/preact-router/dist/preact-router.es.js:335:16
renderComponent
webpack-internal:///./node_modules/preact/dist/preact.mjs:526:14
renderComponent
webpack-internal:///./node_modules/preact/dist/preact.mjs:554:5
setComponentProps
webpack-internal:///./node_modules/preact/dist/preact.mjs:475:4
buildComponentFromVNode
webpack-internal:///./node_modules/preact/dist/preact.mjs:641:3
idiff
webpack-internal:///./node_modules/preact/dist/preact.mjs:252:10
diff
webpack-internal:///./node_modules/preact/dist/preact.mjs:213:12
render
webpack-internal:///./node_modules/preact/dist/preact.mjs:708:10
<anonymous>
webpack-internal:///./src/index.js:123:2
./src/index.js
<snipped>
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

1 participant