When selectedTileset() is called in an handlebars template, a new cursor with an observer is created for each call (e.g tile2domX, tile2domY, etc), meaning that, for a large template, when a tileset is edited (for collision or layering), Meteor does literally thousands of local Minimongo updates of the tileset document copies, taking several seconds to perform.
This part might need a bigger refactoring but in the meanwhile I suggest this small optimization which allows to create a new observer only when the selected tileset changes.
When
selectedTileset()
is called in an handlebars template, a new cursor with an observer is created for each call (e.gtile2domX
,tile2domY
, etc), meaning that, for a large template, when a tileset is edited (for collision or layering), Meteor does literally thousands of local Minimongo updates of the tileset document copies, taking several seconds to perform.This part might need a bigger refactoring but in the meanwhile I suggest this small optimization which allows to create a new observer only when the selected tileset changes.