[BUGFIX] plain method calling from templates (no explicit binding required -- follows JS semantics) - on still requires binding - #21469
Draft
NullVoxPopuli wants to merge 1 commit into
Draft
NullVoxPopuli wants to merge 1 commit into
NullVoxPopuli wants to merge 1 commit into
Conversation
NullVoxPopuli
commented
Jun 12, 2026
| assert.equal(this.stashedFn(), 'arg1: foo, arg2: bar'); | ||
| } | ||
|
|
||
| '@test there is no `this` context within the callback'(assert) { |
Contributor
Author
There was a problem hiding this comment.
a change in behavior, but for the better -- I dare say: a bugfix
Contributor
📊 Size reportTarball size — dist/dev 0.1%↑
dist/prod 0.1%↑
smoke-tests/v2-app-template/dist 0.1%↑
smoke-tests/v2-app-hello-world-template/dist 0.2%↑
🤖 This report was automatically generated by wyvox/pkg-size |
NullVoxPopuli
marked this pull request as ready for review
June 12, 2026 20:35
NullVoxPopuli
commented
Jun 12, 2026
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- @fixme | ||
| return (fn as AnyFn).call(context, ...args, ...invocationArgs); | ||
| return (fn as AnyFn).call(self, ...args, ...invocationArgs); |
Contributor
Author
There was a problem hiding this comment.
the actual fix is here
NullVoxPopuli
commented
Jun 12, 2026
| * The reference this one was created from via a property read (`parent.path`), | ||
| * if any. See {@linkcode parentRefFor}. | ||
| */ | ||
| public parent: Nullable<Reference> = null; |
Contributor
Author
There was a problem hiding this comment.
more reference linking 🙈
ef4
reviewed
Jun 16, 2026
Contributor
Author
|
from review times -- this PR needs to be re-worked to only solve |
NullVoxPopuli
marked this pull request as draft
June 16, 2026 18:24
NullVoxPopuli
force-pushed
the
nvp/fix-this-binding-for-real
branch
from
June 16, 2026 20:53
f25e012 to
889278b
Compare
on still requires binding
NullVoxPopuli
force-pushed
the
nvp/fix-this-binding-for-real
branch
2 times, most recently
from
June 16, 2026 21:44
4b573d6 to
9c29b51
Compare
NullVoxPopuli
marked this pull request as ready for review
June 16, 2026 22:11
NullVoxPopuli
commented
Jun 30, 2026
| associateDestroyableChild(helperInstanceRef, helperRef); | ||
| } else if (isIndexable(definition)) { | ||
| let helper = resolveHelper(definition, ref); | ||
| let helper = resolveHelper(bindFunctionToParent(definition, ref), ref); |
Contributor
Author
There was a problem hiding this comment.
TODO: move to invokeHelper
NullVoxPopuli
force-pushed
the
nvp/fix-this-binding-for-real
branch
from
June 30, 2026 19:16
9c29b51 to
31130d8
Compare
NullVoxPopuli
marked this pull request as draft
June 30, 2026 19:17
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
NullVoxPopuli
force-pushed
the
nvp/fix-this-binding-for-real
branch
from
September 1, 2026 13:49
9e08c07 to
ad343b4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
supersedes
this PR enables/unblocks the change in recommendation RFC:
@actiondecorator rfcs#1045Notes
we can't tie this-fixes to invokeHelper, because a helper manager's return value is from
getValue, which only receives the args and definition from createHelper, so like.. 😬as in, the helper manager pattern is what is screwing us over here, because we (correctly?) abstracted references away from public API, but the reference is what is needed to invoke functions.
So, now the path forward I see is to... not use a helper a manager for the "default helper manager" case, and wire it all up using only private apis, no manager
I think the best I con do is bind the definition before createHelper (only for the default case)
Main test cases I care about:
Things we didn't fix (because these are problems with JavaScript)
on(addEventListener)REPL PR: NullVoxPopuli/limber#2170
Deployed: https://test-ember-source-nvp-fix-th.limber-glimdown.pages.dev/
Demo: https://test-ember-source-nvp-fix-th.limber-glimdown.pages.dev/edit?c=JYWwDg9gTgLgBAYQuCA7Apq%2BAzKy4DkAAgOYA2oI6UA9AMbKQZYEDcAUKJLHAN5wwoAQzoBrdABM4AXzi58xcpWo1BI0cFQk27dugAe3eBPTYhAVzLw6ZIQGc7cABLoyZCAHVoZKQZiYJRyQUZnhedjg4IjUxSTgGcyw4AF44AAYOCLgaGjgodABHc2B8qRgIOAAjdDghKDwAdzg7GGA3LM06fKok1IAKAEoUgD4%2BLMiYAAtgOwA6BKSAalSARg5I2V1IiQhzSrJJQbHIyPyYcyhUAWm5hfgAKjgAJnWZLbgAHn9wW39h8c%2BYGGAE1dnBJkIAG41GzAWJlSY1SrmGDlK68XhTGbzXZYaSyVpUOYfGhAgEfIFCVBSHZ7A4SABcfExN1mtP2knxJLJ5ORqLQAgAnmB0MkAER8tFi5kCsWwsTSrFzTrdTAwfHDBAUMQkyVof6REnfMC-dD-aTsIA&format=gjs