Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.6.1 #371

Merged
merged 23 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
80e8a62
fix(view): prevent firing callbacks until members are destroyed
jankapunkt Apr 14, 2022
6e42e57
Remove tests for removed API in spacebars, fix #369
StorytellerCZ Apr 14, 2022
933d8f0
Revert "Remove tests for removed API in spacebars, fix #369"
StorytellerCZ Apr 14, 2022
0832a3f
Return Template.__define__
StorytellerCZ Apr 15, 2022
dc2cad0
Add history entry
StorytellerCZ Apr 15, 2022
2b09118
Replace removed API with new version
StorytellerCZ Apr 15, 2022
81a7d81
Merge pull request #366 from jankapunkt/fix-destroy-members
denihs Apr 19, 2022
070d425
- Updating history.md
denihs Apr 19, 2022
48853c3
- bumping blaze version to 2.6.1-rc.0
denihs Apr 19, 2022
c508e17
Merge branch 'release-2.6.1' into fix/remove-old-tests
StorytellerCZ Apr 19, 2022
a2123a4
Merge pull request #370 from meteor/fix/remove-old-tests
denihs Apr 20, 2022
4ab041f
- bumping blaze version to 2.6.1-rc.1
denihs Apr 20, 2022
cfae2c4
fix: Blaze.remove should destroy view before detaching
jankapunkt Apr 26, 2022
5f85a72
Merge pull request #374 from jankapunkt/fix-blaze-remove-domrange
StorytellerCZ May 18, 2022
85c24b9
[blaze] Modify 'Must be attached' error
harryadel Jun 18, 2022
6437307
Add test for https://github.com/meteor/blaze/pull/374
harryadel Jun 19, 2022
53fdacb
Check for isDestroyed before Blaze.remove
harryadel Jun 19, 2022
dc2a520
[blaze] Add guarding for templateName
harryadel Jun 19, 2022
334130c
[blaze] Add 'unkown template' as a fallback to templateName
harryadel Jun 19, 2022
e6bf934
fix(DOMRange): Modify 'Must be attached' error to be more descriptive…
jankapunkt Jun 22, 2022
9c7f8c2
Merge branch 'release-2.6.1' into add-tests
jankapunkt Jun 22, 2022
6023abc
update(tests): add test for modified DOMRange "Must be attached" erro…
jankapunkt Jun 22, 2022
03ac1fc
- bumping blaze version to 2.6.1-rc.2
denihs Jul 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v2.6.1, 2022-April-XX
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor thing but we need to update this to the date of relase


* [#370](https://github.com/meteor/blaze/pull/370) `templating-runtime@1.6.1`, returned the `Template.__define__` with warning message
* [#366](https://github.com/meteor/blaze/pull/366) Prevent firing callbacks until members are destroyed
* fix destroying child templates when parent is destroyed; prevents memory leak and DOMRange "not attached" error
StorytellerCZ marked this conversation as resolved.
Show resolved Hide resolved

## v2.6.0, 2022-April-13

* [#330](https://github.com/meteor/blaze/pull/330) Removed deprecated APIs from before Meteor 1.0
Expand Down
66 changes: 33 additions & 33 deletions packages/blaze/.versions
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
allow-deny@1.1.0
babel-compiler@7.6.1
allow-deny@1.1.1
babel-compiler@7.9.0
babel-runtime@1.5.0
base64@1.0.12
binary-heap@1.0.11
blaze@2.5.0
blaze-tools@1.1.2
blaze@2.6.1-rc.1
blaze-tools@1.1.3
boilerplate-generator@1.7.1
caching-compiler@1.2.2
caching-html-compiler@1.1.2
callback-hook@1.3.0
callback-hook@1.4.0
check@1.3.1
ddp@1.4.0
ddp-client@2.4.0
ddp-client@2.5.0
ddp-common@1.4.0
ddp-server@2.3.2
ddp-server@2.5.0
diff-sequence@1.1.1
dynamic-import@0.6.0
ecmascript@0.15.1
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.11.0
ecmascript-runtime-server@0.10.0
ejson@1.1.1
dynamic-import@0.7.2
ecmascript@0.16.2
ecmascript-runtime@0.8.0
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
ejson@1.1.2
fetch@0.1.1
geojson-utils@1.0.10
html-tools@1.1.0
htmljs@1.1.0
id-map@1.1.0
html-tools@1.1.3
htmljs@1.1.1
id-map@1.1.1
inter-process-messaging@0.1.1
jquery@1.11.10
local-test:blaze@2.5.0
logging@1.2.0
meteor@1.9.3
minimongo@1.6.2
modern-browsers@0.1.5
modules@0.16.0
modules-runtime@0.12.0
mongo@1.11.0
local-test:blaze@2.6.1-rc.1
logging@1.3.1
meteor@1.10.0
minimongo@1.8.0
modern-browsers@0.1.7
modules@0.18.0
modules-runtime@0.13.0
mongo@1.14.6
mongo-decimal@0.1.2
mongo-dev-server@1.1.0
mongo-id@1.0.7
npm-mongo@3.9.0
mongo-id@1.0.8
npm-mongo@4.3.1
observe-sequence@1.0.16
ordered-dict@1.1.0
promise@0.11.2
promise@0.12.0
random@1.2.0
react-fast-refresh@0.1.0
react-fast-refresh@0.2.3
reactive-var@1.0.11
reload@1.3.1
retry@1.1.0
routepolicy@1.1.0
socket-stream-client@0.3.1
routepolicy@1.1.1
socket-stream-client@0.4.0
spacebars@1.0.15
spacebars-compiler@1.1.2
templating@1.3.2
templating-compiler@1.3.2
templating-runtime@1.3.2
templating-tools@1.1.2
test-helpers@1.2.0
tinytest@1.1.0
test-helpers@1.3.0
tinytest@1.2.1
tracker@1.2.0
underscore@1.0.10
webapp@1.10.1
webapp@1.13.1
webapp-hashing@1.1.0
2 changes: 1 addition & 1 deletion packages/blaze/builtins.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ Blaze._TemplateWith = function (arg, contentFunc) {
// parent Views in the current template. However, when there's an argument
// (`{{> Template.contentBlock arg}}`), the argument needs to be evaluated
// in the original scope. There's no good order to nest
// Blaze._InOuterTemplateScope and Spacebars.TemplateWith to achieve this,
// Blaze._InOuterTemplateScope and Blaze._TemplateWith to achieve this,
// so we wrap argFunc to run it in the "original parentView" of the
// Blaze._InOuterTemplateScope.
//
Expand Down
8 changes: 6 additions & 2 deletions packages/blaze/domrange.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,13 @@ DOMRange.prototype.destroy = function (_skipNodes) {
DOMRange._destroy(this, _skipNodes);
};

DOMRange.prototype.containsElement = function (elem) {
DOMRange.prototype.containsElement = function (elem, selector, event) {
const templateName = this.view?.name
? this.view.name.split('.')[1]
: 'unknown template';
if (! this.attached)
throw new Error("Must be attached");
throw new Error(`${event} event triggerd with ${selector} on ${templateName} but associated view is not be found.
Make sure the event doesn't destroy the view.`);

// An element is contained in this DOMRange if it's possible to
// reach it by walking parent pointers, first through the DOM and
Expand Down
4 changes: 2 additions & 2 deletions packages/blaze/package.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Package.describe({
name: 'blaze',
summary: "Meteor Reactive Templating library",
version: '2.6.0',
version: '2.6.1-rc.2',
git: 'https://github.com/meteor/blaze.git'
});

Npm.depends({
'lodash.has': '4.5.2',
'lodash.isfunction': '3.0.9',
'lodash.isempty': '4.4.0',
'lodash.isobject': '3.0.2'
'lodash.isobject': '3.0.2'
});

Package.onUse(function (api) {
Expand Down
19 changes: 13 additions & 6 deletions packages/blaze/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,19 @@ Blaze._destroyView = function (view, _skipNodes) {
return;
view.isDestroyed = true;

Blaze._fireCallbacks(view, 'destroyed');

// Destroy views and elements recursively. If _skipNodes,
// only recurse up to views, not elements, for the case where
// the backend (jQuery) is recursing over the elements already.

if (view._domrange)
view._domrange.destroyMembers(_skipNodes);
if (view._domrange) view._domrange.destroyMembers(_skipNodes);

// XXX: fire callbacks after potential members are destroyed
// otherwise it's tracker.flush will cause the above line will
// not be called and their views won't be destroyed
// Involved issues: DOMRange "Must be attached" error, mem leak

Blaze._fireCallbacks(view, 'destroyed');
};

Blaze._destroyNode = function (node) {
Expand Down Expand Up @@ -692,9 +697,11 @@ Blaze.remove = function (view) {
while (view) {
if (! view.isDestroyed) {
var range = view._domrange;
if (range.attached && ! range.parentRange)
range.detach();
range.destroy();

if (range.attached && ! range.parentRange) {
range.detach();
}
}

view = view._hasGeneratedParent && view.parentView;
Expand Down Expand Up @@ -888,7 +895,7 @@ Blaze._addEventMap = function (view, eventMap, thisInHandler) {
handles.push(Blaze._EventSupport.listen(
element, newEvents, selector,
function (evt) {
if (! range.containsElement(evt.currentTarget))
if (! range.containsElement(evt.currentTarget, selector, newEvents))
return null;
var handlerThis = thisInHandler || this;
var handlerArgs = arguments;
Expand Down
20 changes: 20 additions & 0 deletions packages/blaze/view_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,24 @@ if (Meteor.isClient) {
test.equal(buf, "");
});

// this checks, whether a DOMRange is correctly marked as
// desroyed after Blaze.remove has destroyed
// the corresponding view
Tinytest.add("blaze - view - destroy", function (test) {
var v = {
_domrange: Blaze._DOMRange([])
};
v._domrange.view = Blaze.View();
test.equal(v._domrange.view.isDestroyed, false);
Blaze.remove(v);
test.equal(v._domrange.view.isDestroyed, true);
});

// this checks, whether an unattached DOMRange notifies
// correctly about it's root cause, when throwing due to an event
Tinytest.add("blaze - view - attached", function (test) {
test.throws(() => Blaze._DOMRange.prototype.containsElement.call({attached: false, view: {name: 'Template.foo'}}, undefined, '.class', 'click'),
`click event triggerd with .class on foo but associated view is not be found.
Make sure the event doesn't destroy the view.`);
});
}
64 changes: 32 additions & 32 deletions packages/spacebars-tests/.versions
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
allow-deny@1.1.0
babel-compiler@7.6.1
babel-runtime@1.5.0
allow-deny@1.1.1
babel-compiler@7.9.0
babel-runtime@1.5.1
base64@1.0.12
binary-heap@1.0.11
blaze@2.5.0
blaze-tools@1.1.0
boilerplate-generator@1.7.1
caching-compiler@1.2.2
caching-html-compiler@1.2.0
callback-hook@1.3.0
callback-hook@1.4.0
check@1.3.1
ddp@1.4.0
ddp-client@2.4.0
ddp-client@2.5.0
ddp-common@1.4.0
ddp-server@2.3.2
ddp-server@2.5.0
diff-sequence@1.1.1
dynamic-import@0.6.0
ecmascript@0.15.1
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.11.0
ecmascript-runtime-server@0.10.0
ejson@1.1.1
dynamic-import@0.7.2
ecmascript@0.16.2
ecmascript-runtime@0.8.0
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
ejson@1.1.2
es5-shim@4.8.0
fetch@0.1.1
geojson-utils@1.0.10
html-tools@1.1.0
htmljs@1.1.0
id-map@1.1.0
id-map@1.1.1
inter-process-messaging@0.1.1
jquery@1.11.10
local-test:spacebars-tests@1.3.0
logging@1.2.0
local-test:spacebars-tests@1.3.1-rc.2
logging@1.3.1
markdown@1.0.14
meteor@1.9.3
minimongo@1.6.2
modern-browsers@0.1.5
modules@0.16.0
modules-runtime@0.12.0
mongo@1.11.1
mongo-decimal@0.1.2
meteor@1.10.0
minimongo@1.8.0
modern-browsers@0.1.8
modules@0.18.0
modules-runtime@0.13.0
mongo@1.15.0
mongo-decimal@0.1.3
mongo-dev-server@1.1.0
mongo-id@1.0.7
npm-mongo@3.9.0
mongo-id@1.0.8
npm-mongo@4.3.1
observe-sequence@1.0.16
ordered-dict@1.1.0
promise@0.11.2
promise@0.12.0
random@1.2.0
react-fast-refresh@0.1.0
react-fast-refresh@0.2.3
reactive-dict@1.3.0
reactive-var@1.0.11
reload@1.3.1
retry@1.1.0
routepolicy@1.1.0
routepolicy@1.1.1
session@1.2.0
socket-stream-client@0.3.1
socket-stream-client@0.5.0
spacebars@1.2.0
spacebars-compiler@1.2.0
spacebars-tests@1.3.0
spacebars-tests@1.3.1-rc.2
templating@1.4.1
templating-compiler@1.4.1
templating-runtime@1.5.0
templating-tools@1.2.0
test-helpers@1.2.0
tinytest@1.1.0
test-helpers@1.3.0
tinytest@1.2.1
tracker@1.2.0
underscore@1.0.10
webapp@1.10.1
webapp@1.13.1
webapp-hashing@1.1.0
Loading