metor blade template throws “second landmark in same branch” exception in for loop

天大地大妈咪最大 提交于 2019-12-05 10:39:18

This bug is actually a result of using plain-old for loops instead of foreach loops.

The foreach region is preferred over ... [regular for loops] not only because of readability and brevity, but because it also provides Blade with the ability to better integrate with live page updating engines (specifically Meteor and Spark). That is, if the live page update engine supports tracking reactive collections, the most efficient DOM operations may occur to update the view's results in-place, without re-rendering the entire Blade template.

In your case, Spark is failing to re-render your included templates because of matching branches for the same landmark. If you use foreach, this problem is resolved.

However, in some situations (like yours), foreach is not appropriate. I think that the solution here is to create a "regular for loop" syntax within Blade to handle loops. Because of this, I created issue # 157.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!