Skip to content

Commit c9ea7ad

Browse files
committed
v3.4.0
- Compatibility with `[email protected]` - Implement #28 , thanks to @nicooprat - Fix #25 , thanks to @nicooprat - Fix #24 , thanks to @nadeemja - Minor fix in `.render()` method, was causing annoying `.callback is not defined` error - Dependencies update - Replace `meteorhacks:fast-render` in favor of `staringatlights:fast-render` in docs and code - Replace `meteorhacks:inject-data` in favor of `staringatlights:inject-data` in docs and code - Add notice asking to remove `arillo:flow-router-helpers` and `zimme:active-route` if installed, as those packages are both implemented inside FR-Extra - Docs update - Minor version bump is caused by moderate amount of changed code
1 parent 493ef42 commit c9ea7ad

File tree

5 files changed

+61
-44
lines changed

5 files changed

+61
-44
lines changed

.npm/package/npm-shrinkwrap.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.versions

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
1-
2-
3-
babel-compiler@6.19.4
1+
2+
3+
babel-compiler@6.20.0
44
55
66
77
88
9-
boilerplate-generator@1.1.1
9+
boilerplate-generator@1.2.0
1010
1111
1212
1313
14-
15-
14+
15+
16+
1617
1718
18-
19+
1920
2021
21-
22+
2223
23-
24+
2425
25-
26+
2627
2728
2829
2930
3031
3132
3233
33-
local-test:ostrio:flow-router-extra@3.3.3
34-
34+
local-test:ostrio:flow-router-extra@3.4.0
35+
3536
36-
37-
meteorhacks:fast-render@1.0.1
38-
meteorhacks:inject-data@1.0.0
39-
minimongo@1.2.1
40-
modules@0.9.2
37+
38+
meteorhacks:meteorx@1.4.1
39+
meteorhacks:picker@1.0.3
40+
minimongo@1.3.2
41+
modules@0.10.0
4142
42-
43+
44+
4345
44-
45-
46+
4647
4748
48-
ostrio:flow-router-extra@3.3.3
49-
promise@0.8.9
49+
ostrio:flow-router-extra@3.4.0
50+
promise@0.9.0
5051
5152
5253
@@ -56,13 +57,14 @@ [email protected]
5657
5758
5859
60+
staringatlights:[email protected]
61+
staringatlights:[email protected]
5962
6063
6164
6265
6366
64-
6567
6668
67-
69+
6870

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,10 @@ Package['kadira:flow-router'] = Package['ostrio:flow-router-extra'];
787787

788788

789789
### Support this project:
790-
This project can't be possible without [ostr.io](https://ostr.io).
791790

792-
By using [ostr.io](https://ostr.io) you are not only [protecting domain names](https://ostr.io/info/domain-names-protection), [monitoring websites and servers](https://ostr.io/info/monitoring), using [Prerendering for better SEO](https://ostr.io/info/prerendering) of your JavaScript website, but support our Open Source activity, and great packages like this one are available for free.
791+
This project wouldn't be possible without [ostr.io](https://ostr.io).
792+
793+
Using [ostr.io](https://ostr.io) you are not only [protecting domain names](https://ostr.io/info/domain-names-protection), [monitoring websites and servers](https://ostr.io/info/monitoring), using [Prerendering for better SEO](https://ostr.io/info/prerendering) of your JavaScript website, but support our Open Source activity, and great packages like this one could be available for free.
793794

794795
-------
795796

client/renderer.js

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ class BlazeRenderer {
5353
}
5454

5555
render(__layout, __template = false, __data = {}, __callback) {
56+
if (!__layout) {
57+
throw new Meteor.Error(400, '`.render()` - Requires at least one argument');
58+
} else if (!_.isString(__layout) && !(__layout instanceof Blaze.Template)) {
59+
throw new Meteor.Error(400, '`.render()` - First argument must be a String or instance of Blaze.Template');
60+
}
61+
5662
this.queue.push([__layout, __template, __data, __callback]);
5763
this.startQueue();
5864
}
@@ -78,32 +84,41 @@ class BlazeRenderer {
7884
let _layout = false;
7985
let template = __template;
8086
let _template = false;
81-
let callback = __callback || function () {};
87+
let callback = __callback || (() => {});
88+
89+
if (_.isString(layout)) {
90+
_layout = typeof Template !== 'undefined' && Template !== null ? Template[layout] : void 0;
91+
} else if (layout instanceof Blaze.Template) {
92+
_layout = layout;
93+
layout = layout.viewName.replace('Template.', '');
94+
} else {
95+
layout = false;
96+
}
8297

8398
if (_.isString(template)) {
8499
_template = typeof Template !== 'undefined' && Template !== null ? Template[template] : void 0;
85100
} else if (template instanceof Blaze.Template) {
86101
_template = template;
87102
template = template.viewName.replace('Template.', '');
88103
} else if (_.isObject(template)) {
89-
callback = data;
90104
data = template;
91105
template = false;
92106
} else if (_.isFunction(template)) {
93107
callback = template;
94108
template = false;
109+
} else {
110+
template = false;
95111
}
96112

97113
if (_.isFunction(data)) {
98114
callback = data;
99-
data = {};
115+
data = {};
116+
} else if (!_.isObject(data)) {
117+
data = {};
100118
}
101119

102-
if (_.isString(layout)) {
103-
_layout = typeof Template !== 'undefined' && Template !== null ? Template[layout] : void 0;
104-
} else if (layout instanceof Blaze.Template) {
105-
_layout = layout;
106-
layout = layout.viewName.replace('Template.', '');
120+
if (!_.isFunction(callback)) {
121+
callback = () => {};
107122
}
108123

109124
if (!_layout) {
@@ -112,10 +127,9 @@ class BlazeRenderer {
112127
throw new Meteor.Error(404, 'No such layout: ' + layout);
113128
}
114129

115-
const current = this.newState(layout, template);
116-
current.data = data;
117-
current.callback = callback;
118-
130+
const current = this.newState(layout, template);
131+
current.data = data;
132+
current.callback = callback;
119133
let updateTemplate = true;
120134

121135
if (this.old.template.name !== template) {

package.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package.describe({
22
name: 'ostrio:flow-router-extra',
33
summary: 'Carefully extended flow-router with waitOn and template context',
4-
version: '3.3.3',
4+
version: '3.4.0',
55
git: 'https://github.com/VeliovGroup/flow-router'
66
});
77

@@ -26,7 +26,7 @@ Package.onUse(function (api) {
2626
});
2727

2828
Package.onTest(function(api) {
29-
api.use(['ecmascript', 'tinytest', 'underscore', 'reactive-var', 'tracker', 'check', 'mongo', 'http', 'random', 'tmeasday:html5-history-api', 'meteorhacks:fast-render', 'meteorhacks:inject-data', 'ostrio:flow-router-extra']);
29+
api.use(['ecmascript', 'tinytest', 'underscore', 'reactive-var', 'tracker', 'check', 'mongo', 'http', 'random', 'tmeasday:html5-history-api', 'staringatlights:fast-render', 'staringatlights:inject-data', 'ostrio:flow-router-extra']);
3030

3131
api.addFiles('test/common/fast_render_route.js', ['client', 'server']);
3232

@@ -53,5 +53,5 @@ Package.onTest(function(api) {
5353

5454
Npm.depends({
5555
'page': '1.7.1',
56-
'qs': '6.5.0'
56+
'qs': '6.5.1'
5757
});

0 commit comments

Comments
 (0)