Dogstudio / highway

Highway - A Modern Javascript Transitions Manager
https://highway.js.org/
MIT License
1.43k stars 92 forks source link

Cannot use 'in' operator to search for '<name of view>' in undefined #29

Closed danyeah closed 5 years ago

danyeah commented 5 years ago

Hello

I'm trying to use this plugin but after I import the script (using both npm and the minified version)

highway.js:424 Uncaught TypeError: Cannot use 'in' operator to search for 'home' in undefined

in my main js file i have:

       import Highway from '@dogstudio/highway';
    const H = new Highway.Core();

I followed the example and copied and pasted the HTML from the documentation.

What am i doing wrong?

ThaoD5 commented 5 years ago

Hello @danielhq !

The problem is probably coming from the fact that you're not having any renderer ( which is supposed to be fine ), can you, just to be sure, maybe create a renderer for home like in the example just to make sure this is the correct issue here ?

If it is, we're going to have a look at this as soon as possible to fix this problem because your code is supposed to work like that :-)

Thanks for your help and bringing this issue to us

Thao

danyeah commented 5 years ago

Thanks for the reply, i have added:

    class HomeRenderer extends Highway.Renderer {
        onEnter() {
            console.log('hello');
        }
    }
    const H = new Highway.Core({
        renderers: {
            home: HomeRenderer
        }
    });

It is now working, it should work even without custom renderers right?

ThaoD5 commented 5 years ago

Indeed it should work without custom renderers, I keep this issue open so that we have a look at this ASAP :-)

Glad it "fixed" the issue for you ( for now ), we'll definitely have a look at this issue soon

Anthodpnt commented 5 years ago

@danielhq This is now fixed in the v2.0.7, please update and tell us if it's now OK for you as well.