-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[Glimmer2] Add mut helper and update readonly helper #13541
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
Conversation
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.
Is this because the mut wrapping isn't happening?
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.
you're right; updated
|
☔ The latest upstream changes (presumably 3a61d98) made this pull request unmergeable. Please resolve the merge conflicts. |
1d15660 to
863bf3a
Compare
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.
@krisselden @chancancode so this is still failing in glimmer.
To make it backwards compatible for curly components, what ember-htmlbars seems to be doing is disconnecting the readonly if it is updated from a child, such that get(child, 'parentAttr') is no longer the same as child.attr.parentAttr. But when a change comes from the upstream property, the value correctly updates.
I've tried a variety of ways of disconnecting the value from the reference and reconnecting it, but nothing I've tried really works .It also seems like there could be multiple places this logic can go into (should it be in process-args or mut?) Any direction here would be helpful.
faf561e to
182adfd
Compare
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.
Doesn't the value need to be reflected on both sides?
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.
So I added tests to verify the value of component.attrs.myAttr.value and component.get('myAttr')and they all seem to be passing after the update() without any code changes. Is that what you meant?
c62db4f to
9e16add
Compare
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.
Would be nice to put this forking into one of the helper files so that the test can just import { INVOKE } from '../../utils/helpers'; and it would get either the HTMLBars or Glimmer symbol.
|
☔ The latest upstream changes (presumably 0f2d9e6) made this pull request unmergeable. Please resolve the merge conflicts. |
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 is only used for the assertion, but as written it will not get stripped. Can you refactor to avoid splitting in prod builds where the assertion is not needed? Something like:
let value = get(this, key);
runInDebug(function() {
let name = this._debugContainerKey.split(':')[1];
assert(strip`
Cannot set the \`${key}\` property (on component ${name}) to
\`${value}\`. The \`${key}\` property came from an immutable
binding in the template, such as {{${name} ${key}="string"}}
or {{${name} ${key}=(if theTruth "truth" "false")}}.
`, reference[UPDATE]);
});
reference[UPDATE](value);|
This is looking really good. I am no expert in the ember-glimmer techniques (I'll leave that to the rest of the team) but I am curious what you see as the roadmap for this PR. What is still outstanding, what is blocking, etc... One thing I was noticing/thinking about was the auto-mut AST transform, should that be reenabled in this PR? |
|
Rebased and addressed your concerns, @rwjblue . As far as a I can tell there's nothing really blocking this PR, once these issues are resolved
|
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.
Can you change this to a TODO:? I discussed with @chancancode and this seems okish for now, and we can circle back to it later...
|
I was chatting with @chancancode about this abit today, he is going to try to give it more review sometime next week... |
|
☔ The latest upstream changes (presumably #13492) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (presumably #13680) made this pull request unmergeable. Please resolve the merge conflicts. |
Implemented based on comments in #13502
muthelper{{action attrs.somethingUndefined}}returns PropertyReference as opposed to UNDEFINED_REFERENCE, causing a call-time error rather than a create time error