This repository was archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 479
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
Cannot read property 'unsubscribe' of undefined #492
Copy link
Copy link
Closed
Description
Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.
- I'm submitting a ...
- [v ] bug report
- feature request
- support request => Please do not submit support request here, see note at the top of this template.
- What modules are related to this pull-request
- express-engine
- grunt-prerender
- gulp-prerender
- hapi-engine
- universal-preview
- [v ] universal
- webpack-prerender
- Do you want to request a feature or report a bug?
I want to report a bug.
- What is the current behavior?
I'm getting an error when changin a client side route and then reloading a page.
- If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem by creating a github repo.
Here is example of function
function ngApp(req, res) {
let baseUrl = '/base';
//need to remove base from original url
let url = req.originalUrl.replace(baseUrl,'').slice(1) || '/';
let config:ExpressEngineConfig = {
directives: [AppComponent],
platformProviders: [
{provide: ORIGIN_URL, useValue: 'http://localhost:3000/base'},
{provide: BASE_URL, useValue: baseUrl},
],
providers: [
{provide: REQUEST_URL, useValue: url},
provideRouter(routes),
NODE_LOCATION_PROVIDERS,
NODE_HTTP_PROVIDERS,
],
async: false,
preboot: {appRoot:'vacay-app', buffer:true}
};
res.render('vacay', config);
}
Seems server side scripts does'n unsubscribes when needed and then is trying to unsubscribe from not yet subscribed route.
If set aync property to true there is no error.
- What is the expected behavior?
Do not get this error. - What is the motivation / use case for changing the behavior?
Maybe it will help other developers. - Please tell us about your environment:
- Angular version: 2.0.0-rc4
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX ]
- Language: TypeScript 1.
- OS: Linux
- Platform:NodeJs
- Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
Rendering Document Error: TypeError: Cannot read property 'unsubscribe' of undefined
at Router.dispose (/home/vayrex/www/HORISONT/node_modules/@angular/router/src/router.js:189:32)
at /home/vayrex/www/HORISONT/node_modules/@angular/router/src/common_router_providers.js:23:56
at /home/vayrex/www/HORISONT/node_modules/@angular/core/src/application_ref.js:448:68
at Array.forEach (native)
at ApplicationRef_.dispose (/home/vayrex/www/HORISONT/node_modules/@angular/core/src/application_ref.js:448:32)
at /home/vayrex/www/HORISONT/node_modules/angular2-universal/dist/node/bootloader.js:155:45
at ZoneDelegate.invoke (/home/vayrex/www/HORISONT/node_modules/zone.js/dist/zone-node.js:281:29)
at Zone.run (/home/vayrex/www/HORISONT/node_modules/zone.js/dist/zone-node.js:174:44)
at /home/vayrex/www/HORISONT/node_modules/zone.js/dist/zone-node.js:529:58
at ZoneDelegate.invokeTask (/home/vayrex/www/HORISONT/node_modules/zone.js/dist/zone-node.js:314:38)
TypeError: Cannot read property 'unsubscribe' of undefined
at Router.dispose (/home/vayrex/www/HORISONT/node_modules/@angular/router/src/router.js:189:32)
at /home/vayrex/www/HORISONT/node_modules/@angular/router/src/common_router_providers.js:23:56
at /home/vayrex/www/HORISONT/node_modules/@angular/core/src/application_ref.js:448:68
at Array.forEach (native)
at ApplicationRef_.dispose (/home/vayrex/www/HORISONT/node_modules/@angular/core/src/application_ref.js:448:32)
at /home/vayrex/www/HORISONT/node_modules/angular2-universal/dist/node/bootloader.js:155:45
at ZoneDelegate.invoke (/home/vayrex/www/HORISONT/node_modules/zone.js/dist/zone-node.js:281:29)
at Zone.run (/home/vayrex/www/HORISONT/node_modules/zone.js/dist/zone-node.js:174:44)
at /home/vayrex/www/HORISONT/node_modules/zone.js/dist/zone-node.js:529:58
at ZoneDelegate.invokeTask (/home/vayrex/www/HORISONT/node_modules/zone.js/dist/zone-node.js:314:38)
Metadata
Metadata
Assignees
Labels
No labels