-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
each-in breaks on keys that contain a period in 3.8.0-beta.1 #17529
Comments
@jasonmit could you send a PR with the failing test? |
We should definitely root cause this, but I'm not sure that this will be considered a bug in the end. Specifically, |
Yeah pretty sure that’s the reason, each-in uses get so this is sort of a duplicate of the get with dot path ticket. Mayyyybe in this specific case we don’t need to use get in here after landing ES5 getters because this probably doesn’t work with proxies anyway? |
I agree I’m not sure if this is considered a bug and whether fixing this now will cause problems elsewhere or down the road |
Ya, and I actually think we do different things based on the heuristics on the object being iterated here: ember.js/packages/@ember/-internals/glimmer/lib/utils/iterable.ts Lines 290 to 298 in 7df81ec
Some of those iterators use |
We are looking at the |
@chancancode - ya, I only point it out because @jasonmit could possibly work around the issue by making the object implement |
Definitely, I'll do that now and link the issue.
Great idea, I'll try that out as a work around. In case you're curious why we have periods in the key, the keys in the object being iterated over are ISO strings (i.e., |
Just wondering what the status of this is? Thanks all |
@amk221 I don't believe this was resolved, we ended up refactoring our app to avoid the period in the key but obviously not an ideal solution for everyone. |
Hi everyone, I made a PR for this one, asking for a review :D |
Anything I can do to get this moving along? We really need this 🤞 |
@amk221 you can add a helper. Thats how I solved the Problem. |
Just wasted a couple hours on this - I'm super new to Ember and this was completely surprising. For my app, I'm tracking status for a bunch of hosts, so keying a hash by the IP or domain name. It was returning undefined for everything except |
@devop911 care to share your helper 😁 |
@amk221 Not the one you're asking, but I ended up using this a bunch: import { helper } from '@ember/component/helper';
import _ from 'lodash';
export function hashToArray([h]) {
return _.map(h, function(value, key) {
return {
key: key,
value: value,
}
});
}
export default helper(hashToArray); |
I just hit this issue as well. Any updates? |
I'm not sure we can fix this without regressing the common use case for We could manually check for proxies and use Long term, tracked props can't come soon enough 😩 |
Long Story short: Switch to anything else then Ember. It's not worth all the trouble. |
@devop911 comments like that aren't super constructive or helpful. We absolutely want to solve this problem, but we also don't want to regress performance in user's applications for an edge case that is relatively uncommon. It's a difficult situation to be in as a maintainer. We'll figure out a fix for this in time, it just needs a bit more work than a typical issue and we've been focused on shipping features for Octane. I agree, this is important though. |
@pzuraq |
@pzuraq I think we should at least have a warning that is thrown if the key to |
@devop911 my assessment of it being an edge case was based on the fact that we've seen very few reports of this bug overall since this issue was opened. If this were behavior that every Ember application relied on, it would have been a higher priority fix, absolutely, but it seems that not many folks use periods in their keys. On the flip side, we do get lots of complaints whenever we regress performance. If this weren't a hot path, the fix would definitely have come a lot earlier. Like I said, it's a difficult situation to be in as a maintainer, especially when you're trying to get things done 😩 I'll see what we can do to get someone working on this sooner rather than later @rwwagner90 I do think we can fix the behavior, so I'd rather not start warning, but if we can't fix it I agree we should definitely warn users. |
Fixed by #18296 |
Thanks everyone for coming up with a solve ❤️ |
{{each-in}}
will returnundefined
for the value whose key contains a period.This bug does not exist in 3.7.2 and first appears in 3.8.0-beta.1 and is still present in 3.8.0-beta.3.
Fail test (drop in
packages/@ember/-internals/glimmer/tests/integration/syntax/each-in-test.js
)The text was updated successfully, but these errors were encountered: