peerlibrary / meteor-blaze-components

Reusable components for Blaze
http://components.meteorapp.com/
BSD 3-Clause "New" or "Revised" License
354 stars 26 forks source link

Adding blazecomponents package breaks Meteor v1.2 Blaze #each ... in block helper #100

Closed rjsmith closed 9 years ago

rjsmith commented 9 years ago

Simply adding peerlibrary:blaze-components to a Meteor v1.2 application seems to break the {{#each foo in getFoos}} block helper aded in Meteor v1.2 ... the foo field does not get set in the data context inside the each block.

See this meteorpad (using blaze-components 0.13.0, but I just verified that exactly the same thing happens with current 0.15.0). It's the standard leaderboard app, but using #each .. in ..

http://meteorpad.com/pad/wCpsPdyfrHTnDm8gf/BlazeComponents

If you remove BlazeComponents, the each block works again.

PS> I don't use blaze components myself, but spotted the problem after adding easy:search package to my application yesterday. Someone else has spotted this problem also there.

mitar commented 9 years ago

Yes, because that are lexical scopes and not data context. MDG decided to implement something new, called lexical scope. So lexical scope is not visible through data context. I think this is a bad design, but they are saying it is good. :-) (I think data context should represent anything which developer sees in the template, in my view.)

See https://github.com/peerlibrary/meteor-blaze-components/issues/76 and https://github.com/meteor/meteor/issues/5280.

mitar commented 9 years ago

BTW, can you create a small reproduction here? So some other template which uses each ... in which is not a Blaze Component and which stops working once Blaze Components are added?

mitar commented 9 years ago

Hm, maybe the issue is lookup.js file. Can you try removing it (it should not be needed in 1.2 anymore) and see if it works?

rjsmith commented 9 years ago

Hi, Thanks for the swift reply. Did you look at the meteorpad I linked to? The leaderboard templates do not use blaze components .. simply removing the blaze components package resolves the problem.

re: removing lookup.js. Sorry, not sure how to do that .. would I have to install blaze components locally, then remove the file? As I said, I've only come across this problem because I really wanted to use easy:search (which just happens to use blaze components)

On Tuesday, 27 October 2015, Mitar notifications@github.com wrote:

Hm, maybe the issue is lookup.js file https://github.com/peerlibrary/meteor-blaze-components/blob/master/lookup.js. Can you try removing it (it should not be needed in 1.2 anymore) and see if it works?

— Reply to this email directly or view it on GitHub https://github.com/peerlibrary/meteor-blaze-components/issues/100#issuecomment-151628870 .

dburles commented 9 years ago

+1 we just updated to easy-search v2.0 which uses this package as a dependency and this bug has caused parts of our application that use each..in to break!

mitar commented 9 years ago

Released 0.15.1 with a fix 5ed74a121205b8d6459c183250fcb0de5a403ede. meteor update should probably fix the issue for you now?