-
Notifications
You must be signed in to change notification settings - Fork 191
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
[FEATURE] Upstream built-in helpers and modifiers from Ember #1245
Conversation
Current failure is:
|
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.
- Why are the various test files empty?
- packages/@glimmer/integration-tests/test/helpers/array-test.ts
- packages/@glimmer/integration-tests/test/helpers/fn-test.ts
- packages/@glimmer/integration-tests/test/helpers/get-test.ts
- packages/@glimmer/integration-tests/test/helpers/hash-test.ts
- packages/@glimmer/integration-tests/test/helpers/concat-test.ts
- packages/@glimmer/integration-tests/test/helpers/array-test.ts
* @param obj The object provided to get a value from | ||
* @param path The path to get the value from | ||
*/ | ||
export let setPath: (obj: object, path: string, value: unknown) => unknown; |
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 curious why we'd actually need setPath
, wouldn't all sets end up being setProp
(I thought TWB for {{whatever someArg=foo.bar.baz}}
we'd be calling setProp
for bar['baz']
instead of Ember.set(foo, 'bar.baz')
)?
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 specifically for {{get}}
. In general, when we see a path in Glimmer, we break it down into a chain of references. However, when the path is dynamic, we cannot do that, we have to do it all within a single reference. We already had getPath
because there was an instance of this before for getting a path (the key
on each
) but we never encountered a setPath
before. {{get}}
can also update the value that is accessed (similar to how mut
works), so that's why we need the ability to set a path - it's dynamic and not broken down into pieces.
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 to clarify, its for (mut (get
being used together (since I didn't think that {{something whatever=(get otherThing 'lol.path')}} allowed mutation of
otherThing.lol.path`)? Is that right?
packages/@glimmer/integration-tests/test/keywords/array-test.ts
Outdated
Show resolved
Hide resolved
ad9dec5
to
f4b315f
Compare
e75450d
to
a433a62
Compare
Upstreams the built-in helpers and modifiers from Ember: - `on` - `fn` - `array` - `hash` - `get` - `concat` \## Breaking Changes - `setPath` is now required on the global context
a433a62
to
7e3ef01
Compare
Upstreams the built-in helpers and modifiers from Ember:
on
fn
array
hash
get
concat
Tests were adapted directly from the existing test suites in Ember, with omissions wherever particular test functionality did not make sense (e.g. integration testing
get
with<Input/>
).Breaking Changes
setPath
is now required on the global context