-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.25] fix nested partials #732
[0.25] fix nested partials #732
Conversation
value = evalScope[name]; | ||
} else { | ||
value = locals[name]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear on the differences between locals
and evalScope
. Some questions:
- should
locals
contain theouterScope.getPartialMap()
like I'm doing above or perhaps it belongs inevalScope
? - when iterating over the
partialSymbols
, should we just be checkingevalScope
or is it ok to fallback tolocals
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
locals are supposed to win, they are names the partial introduced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
CI seems flaky:
Tests pass locally: |
This is ready for review |
}); | ||
|
||
QUnit.test('nested partials within nested `{{#with}}` blocks', () => { | ||
let template = compile(`{{#with 'Sophie' as |person1|}}Hi {{person1}} (aged {{age}}), {{person2}}, {{person3}} and {{person4}}. {{partial 'person2-partial'}}{{/with}}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I think I'll change this to
Hi {{person1}}. {{#with 'Sophie' as |person1|}}Hi {{person1}}...
so that we render something from the outer conext
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 sounds good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
outerEvalScope = {}; | ||
} | ||
|
||
let mergedScope = Object.assign(outerEvalScope, locals); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't rely on Object.assign
in this version, we have a shared assign
utility method that we can use though.
export function assign(obj: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, thanks
equalTokens(root, `Before [mantle Sophie (0) [outer Sophie (0) [inner Sophie (0)]]] After`); | ||
rerender({ age: 0 }, { assertStable: true }); | ||
equalTokens(root, `Before [mantle Sophie (0) [outer Sophie (0) [inner Sophie (0)]]] After`); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test seems superfluous now that we have the nested partials within nested {{#with}} blocks
test below, I'll remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally up to you, it certainly doesn't hurt to have two tests...
I'll port these changes to master now in #730 |
fixes #728
addresses emberjs/ember.js#15791 (will be fixed once we release a new ember version with this change)