{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vue-router/issues/648","repository_url":"https://api.github.com/repos/vuejs/vue-router","labels_url":"https://api.github.com/repos/vuejs/vue-router/issues/648/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue-router/issues/648/comments","events_url":"https://api.github.com/repos/vuejs/vue-router/issues/648/events","html_url":"https://github.com/vuejs/vue-router/issues/648","id":175771639,"number":648,"title":"[next] beforeRouteEnter : vm is undefined inside promise","user":{"login":"swannknani","id":1637657,"avatar_url":"https://avatars.githubusercontent.com/u/1637657?v=3","gravatar_id":"","url":"https://api.github.com/users/swannknani","html_url":"https://github.com/swannknani","followers_url":"https://api.github.com/users/swannknani/followers","following_url":"https://api.github.com/users/swannknani/following{/other_user}","gists_url":"https://api.github.com/users/swannknani/gists{/gist_id}","starred_url":"https://api.github.com/users/swannknani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swannknani/subscriptions","organizations_url":"https://api.github.com/users/swannknani/orgs","repos_url":"https://api.github.com/users/swannknani/repos","events_url":"https://api.github.com/users/swannknani/events{/privacy}","received_events_url":"https://api.github.com/users/swannknani/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vuejs/vue-router/labels/need%20repro","name":"need repro","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"LinusBorg","id":1444526,"avatar_url":"https://avatars.githubusercontent.com/u/1444526?v=3","gravatar_id":"","url":"https://api.github.com/users/LinusBorg","html_url":"https://github.com/LinusBorg","followers_url":"https://api.github.com/users/LinusBorg/followers","following_url":"https://api.github.com/users/LinusBorg/following{/other_user}","gists_url":"https://api.github.com/users/LinusBorg/gists{/gist_id}","starred_url":"https://api.github.com/users/LinusBorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LinusBorg/subscriptions","organizations_url":"https://api.github.com/users/LinusBorg/orgs","repos_url":"https://api.github.com/users/LinusBorg/repos","events_url":"https://api.github.com/users/LinusBorg/events{/privacy}","received_events_url":"https://api.github.com/users/LinusBorg/received_events","type":"User","site_admin":false},"assignees":[{"login":"LinusBorg","id":1444526,"avatar_url":"https://avatars.githubusercontent.com/u/1444526?v=3","gravatar_id":"","url":"https://api.github.com/users/LinusBorg","html_url":"https://github.com/LinusBorg","followers_url":"https://api.github.com/users/LinusBorg/followers","following_url":"https://api.github.com/users/LinusBorg/following{/other_user}","gists_url":"https://api.github.com/users/LinusBorg/gists{/gist_id}","starred_url":"https://api.github.com/users/LinusBorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LinusBorg/subscriptions","organizations_url":"https://api.github.com/users/LinusBorg/orgs","repos_url":"https://api.github.com/users/LinusBorg/repos","events_url":"https://api.github.com/users/LinusBorg/events{/privacy}","received_events_url":"https://api.github.com/users/LinusBorg/received_events","type":"User","site_admin":false}],"milestone":null,"comments":17,"created_at":"2016-09-08T14:39:10Z","updated_at":"2016-10-08T05:50:43Z","closed_at":null,"body":"Hi,\r\n\r\nI'm experiencing a weird issue when using vue-router@2.0.\r\nAccording to : [release docs](https://github.com/vuejs/vue-router/releases), I'm trying to fetch data with a random API (no matter witch API I use) but the ```vm``` callback is ```undefined```.\r\nIn the other hand when I'm logging ```vm``` without using a request promise, ```vm``` is defined.\r\n\r\n```\r\nbeforeRouteEnter(route, redirect, next) {\r\n\r\n\treturn superagent\r\n\t.get(PATH_API + PATH_PROJECTS)\r\n\t.end((err, res) => {\r\n\t\r\n\t\tnext(vm => {\r\n\r\n\t\t\t// Here vm is undefined \r\n\t\t\tconsole.log(vm);\r\n\t\r\n\t\t});\r\n\t\r\n\t});\r\n}\r\n```\r\n\r\n```\r\nbeforeRouteEnter(route, redirect, next) {\r\n\tnext(vm => {\r\n\r\n\t\t// Here vm is defined \r\n\t\tconsole.log(vm);\r\n\r\n\t});\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/vuejs/vue-router/issues/comments/252405022","html_url":"https://github.com/vuejs/vue-router/issues/648#issuecomment-252405022","issue_url":"https://api.github.com/repos/vuejs/vue-router/issues/648","id":252405022,"user":{"login":"erguotou520","id":7945757,"avatar_url":"https://avatars.githubusercontent.com/u/7945757?v=3","gravatar_id":"","url":"https://api.github.com/users/erguotou520","html_url":"https://github.com/erguotou520","followers_url":"https://api.github.com/users/erguotou520/followers","following_url":"https://api.github.com/users/erguotou520/following{/other_user}","gists_url":"https://api.github.com/users/erguotou520/gists{/gist_id}","starred_url":"https://api.github.com/users/erguotou520/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erguotou520/subscriptions","organizations_url":"https://api.github.com/users/erguotou520/orgs","repos_url":"https://api.github.com/users/erguotou520/repos","events_url":"https://api.github.com/users/erguotou520/events{/privacy}","received_events_url":"https://api.github.com/users/erguotou520/received_events","type":"User","site_admin":false},"created_at":"2016-10-08T05:50:43Z","updated_at":"2016-10-08T05:50:43Z","body":"It can be reproduce when change the routes settings to children routes. \r\nThe same repo above https://github.com/erguotou520/dashboard.\r\n### Step\r\n1.\r\n    ```shell\r\n    npm i\r\n    npm run dev\r\n    # open localhost:8082\r\n    ```\r\n2. Click to `foo`, then click to `bar`, you can see error on console `Cannot set property 'msg' of undefined(…)`\r\n\r\n### Router settings\r\n```js\r\n{\r\n  routes: [{\r\n    path: '/',\r\n    component: (resolve) => {\r\n      require(['./components/CommonView.vue'], resolve)\r\n    },\r\n    children: [{\r\n      path: 'foo',\r\n      component: (resolve) => {\r\n        require(['./components/Foo.vue'], resolve)\r\n      }\r\n    }, {\r\n      path: 'bar',\r\n      component: (resolve) => {\r\n        require(['./components/Bar.vue'], resolve)\r\n      }\r\n    }]\r\n  }]\r\n}\r\n``` "}}
{"actor":{"display_login":"erguotou520"}}