Skip to content

Commit fb070ad

Browse files
committed
Merge pull request #11 from dferber90/master
stop query handle when tmpl is destroyed
2 parents 337dfd1 + 2edf435 commit fb070ad

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

package.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package.describe({
22
name: 'smeevil:reactive-block-grid',
33
summary: 'Given a cursor and a template this will create a reactive responsive block grid based on isotope',
4-
version: '1.0.2',
4+
version: '1.0.3',
55
git: 'https://github.com/smeevil/responsive-block-grid.git'
66
});
77

reactive_block_grid.coffee

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ Template.reactiveBlockGrid.helpers
2626
cssClasses: ->
2727
@cssClass
2828

29+
Template.reactiveBlockGrid.destroyed = ()->
30+
if @queryHandle
31+
@queryHandle.stop()
32+
@queryHandle = null
33+
2934
Template.reactiveBlockGrid.rendered = ()->
3035
options={
3136
itemSelector: 'li'
@@ -59,7 +64,7 @@ Template.reactiveBlockGrid.rendered = ()->
5964

6065
if @data.cursor.limit? || @data.cursor.skip?
6166

62-
@data.cursor.observeChanges
67+
@queryHandle = @data.cursor.observeChanges
6368
addedBefore: -> null
6469
movedBefore: -> null
6570

@@ -69,7 +74,7 @@ Template.reactiveBlockGrid.rendered = ()->
6974
$el.isotope('remove', item).isotope('layout')
7075

7176
else
72-
@data.cursor.observe
77+
@queryHandle = @data.cursor.observe
7378
removed: (doc) ->
7479
selector="[data-reactive-block-grid-item-id=#{doc._id}]"
7580
item=$el.find(selector)

0 commit comments

Comments
 (0)