Closed tadatuta closed 7 years ago
Let's consider real life use case.
If we have BEMHTML template, we can go with
block('b1').def()(function() { return applyNext({ 'mods.m1': 'blah' }); });
and get <div class="b1 b1_m1_blah"></div>
which is exactly what was expected.
And if we move the same template to BEMTREE, it will actually apply all the templates for b1_m1_blah
(if present) but won't add m1
modifier and as so we'll just get <div class="b1"></div>
as a result.
Yeah, it looks like a critical thing for bemtree.
It look like won’t fix.
I think mods.m1
is kind of hack which you do not want use. And why you want apply b1_m1_blah
but won’t add modifier?
I don't know why mods.m1
is a hack but still think current implementation far from intuitive.
PS: The issue was created as a result of a bug in real project code (and it took quite a while to understand what's going on there).
I just was asked why
block('bla').def()(function() {
return applyNext({ 'ctx.js': { bla: 1 } });
});
is not working in BEMTREE.
Still think it's a bug.
I Agree. Bug.
Template:
block('b').def()(function() {
return applyNext({ 'ctx.js': { bla: 1 } });
});
BEMJSON:
{ block: 'b' }
BEMTREE result:
{ block: 'b', js: undefined }
this is quite annoying when using extend
mode :(
@tadatuta can’t reproduce in v8.x
Fixed in v8.5.0 via commit https://github.com/bem/bem-xjst/commit/70cfeb51c6#diff-a30c5c85232865c509b331edfca9e65bR43
blah
equalsundefined
here.I understand that
bem-xjst
tries to rollback the state after it went out oflocal
and for performance reason does not delete context keys but just assign them toundefined
but it still isn't quite intuitive.