Implement Default Helper Manager (RFC #756)#1348
Implement Default Helper Manager (RFC #756)#1348chancancode merged 3 commits intoglimmerjs:masterfrom
Conversation
57d246d to
c4b2975
Compare
it already is. sus |
rwjblue
left a comment
There was a problem hiding this comment.
Needs a whole slew of tests 😉
I haven't gotten there yet :p still draft 🙃 |
c4b2975 to
bfcc8a9
Compare
d899490 to
cee1965
Compare
cee1965 to
65d945d
Compare
65d945d to
f184735
Compare
|
@rwjblue ready for review / added some tests. Not sure how many test scenarios you want / feel necessary, so if you think of more that are needed, lemme know |
f184735 to
374b636
Compare
374b636 to
0addbcf
Compare
|
This one probably requires more focused attention, will come back to it next week |
0addbcf to
db8a13c
Compare
|
sg, rebased |
|
@chancancode should be green - linting seems to have failed for random networking reasons |
|
I re-read the RFC but I couldn't tell: are we supposed to always invoke the function with an options argument even when syntactically there were no named arguments passed? i.e. should It seems slightly/somewhat problematic either way – but so far I am leaning towards the former. The latter is more consistent I suppose, but if you are deliberately passing a function takes optional positional arguments that are normally defaulted for you (which there are a lot), then always passing an empty object would be problematic. On the other hand, I am not sure if we have any precedence of distinguishing between having zero named arguments vs did not pass any named arguments. I think syntactically, the distinction does not exist today. But if/when we add splat syntaxes that would make a difference. We should pick one carefully; we may want to do a quick amendment PR to the RFC to see if anyone else want to chime in. |
|
I also can't tell from the RFC: class MyComponent {
@tracked name = '...';
greet(message) {
return `${message}, ${this.name}`; // <- do we call this function again when `this.name` changes?
}
}Personally I think the answer is yes (and there probably isn't other options given how the system works), but 1. we should have test for it; 2. we should update the RFC to state it explicitly |
I think it should be let options = args[args.length - 1];
// or
let [options] = args.reverse();giving a stable type is good DX, imo, and reduces the amount of surprise when arguments aren't passed.
why call? normal invocation preserves the
yes, autotracking is maintained with helpers today.
there already is a test,
Sounds reasonable (esp since our RFCs tend to be the source of truth for docs until an edition lands). |
See above. Not saying it should definitely be
I was just being clear/precise/pedantic, this already is what's happening. When you write
I am specifically asking about when the tracked state does NOT come from an argument (i.e. from |
|
Thanks for the review, @chancancode -- I think I've addressed everything, and added a todo to the PR description for everything that I'm aware of remainaing (just PRing to the RFC an example showing current behavior of auto-tracking local tracked data accessed from within the helpers) |
dbb8a95 to
7d7b3b8
Compare
IMO we should still add tests for this case for the default manager
Sounds good. I think this is good to clarify, but probably secondary to/not as important as clarifying whether there is or is not an automatic If you are able to open the PR, I can bring it up for discussion on Friday to give it some attention, then we can see if we decided to just merge that PR, or tweet that PR for 1-week FCP, etc. Thanks for working on this! |
7d7b3b8 to
cf7f907
Compare
I think the easiest way to do that in tests would be something like Not sure what is available in the test harness here, alternatively you may be able to use a "tracked object" thing, but you can probably find examples in tests covering this behavior in regular helpers |
cf7f907 to
634c78f
Compare
added test: |
634c78f to
8b6cf95
Compare
8b6cf95 to
0fddcc1
Compare
|
Types are now greatly simplified. Thanks @chancancode, @chriskrycho, and @dfreeman !!! |
Co-authored-by: Godfrey Chan <godfreykfc@gmail.com>
|
@NullVoxPopuli Awesome! 🎉 |
Implementation of emberjs/rfcs#756
Todo: