Skip to content

Commit bba4568

Browse files
committedJul 6, 2017
Smarter blacklist behaviour (explicit "server: true" or "server: false" in routes will now always be respected regardless of --blacklist)
1 parent 4a085f1 commit bba4568

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ssr",
3-
"version": "0.10.31",
3+
"version": "0.10.32",
44
"description": "Angular server-side rendering implementation",
55
"main": "build/index.js",
66
"typings": "build/index.d.ts",

‎source/application/builder/impl/application.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,24 @@ export class ApplicationImpl<V, M> implements Application<V> {
3030
this.render.pessimistic = (options && options.pessimistic) || false;
3131

3232
return Observable.create(async (observe) => {
33-
if (this.render.routes == null || this.render.routes.length === 0) {
34-
this.render.routes = renderableRoutes(await this.discoverRoutes());
33+
let routes = this.render.routes;
34+
if (routes == null || routes.length === 0) {
35+
routes = renderableRoutes(await this.discoverRoutes());
3536
}
3637

37-
if (this.render.blacklist) { // route blacklisting
38-
this.render.routes = this.render.routes.filter((r: Route & {server?: boolean}) => r.server === true);
39-
}
38+
routes = routes.filter((r: Route & {server?: boolean}) => {
39+
if (r.server == null) {
40+
return this.render.blacklist === true; // exclude all routes by default
41+
}
42+
return r.server; // explicit true or false will always be respected regardless of blacklisting
43+
});
4044

41-
if (this.render.routes.length === 0) {
45+
if (routes.length === 0) {
4246
observe.complete();
4347
}
4448
else {
49+
this.render.routes = routes;
50+
4551
this.renderToStream(this.render)
4652
.subscribe(
4753
observe.next.bind(observe),

0 commit comments

Comments
 (0)
Failed to load comments.