Skip to content
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

chore: fail test for each-in not accessing props properly whose keys contain a period #17535

Closed
wants to merge 23 commits into from

Conversation

jasonmit
Copy link
Member

@jasonmit jasonmit commented Jan 30, 2019

Related to #17529

kategengler and others added 23 commits January 7, 2019 16:55
[BUGFIX beta] Fix substate interactions with aborts
[ci skip]

(cherry picked from commit dd7a199)
This fixes emberjs#17243 by only removing dependent keys in `teardown`.

Since emberjs#16978 coalesces the work to add dependent keys to happen at
most once, it is now incorrect to eagerly remove them in `didUnwatch`
because that could happen for a variety of reasons while there are
still other interested parties (see attached test cases).

This limits the work of removing dependent keys to `teardown` only.
The logic is that, while we want to defer setting up the "link" to
the target property as lazily as possible, it is less important to
"unlink" it eagerly once the work is done. It _may_ be possible to
accomplish this, but the current amount of book-keeping is not
sufficient to track the count properly. In our tests, we have
created sequences like this:

1. setup (peekWatching = 0, so nothing happens)
2. get (consumed here)
3. willWatch (already consumed, no-op)
4. get (already consumed, no-op)
5. didUnwatch
6. ...

In this case, it would be incorrect to "unlink" at step 5. As of
PR emberjs#16978, `CONSUMED` is essentially a boolean flag, so it is not
sufficient to track the balance, and also, there is no counterpart
to `get`, which makes eager "unlinking" impossible without much
more book-keeping. It's unclear that it would be worthwhile to do
that.

On the other hand, if we only "unlink" on teardown, this ensures
that we are only "unlinking" at most once, and it is guaranteed
that there are no longer any interested parties.

Fixes emberjs#17243

Co-authored-by: Godfrey Chan <godfreykfc@gmail.com>
(cherry picked from commit 1f8218b)
Fixes a few issues:

* Usage of positional arguments with custom components.
* Forwarding attributes via `...attributes` to a dynamic
  component.
* Prevent errors when rendering many template blocks
  (`Error: Operand over 16-bits. Got 65536`).

Full changes here:

glimmerjs/glimmer-vm@v0.37.0...v0.37.1
(cherry picked from commit 7600d7b)
…nent invoked with angle-bracket syntax that receives splattributes

(cherry picked from commit 2d1f8d0)
(cherry picked from commit 7eca43f)
…warded.

(cherry picked from commit 4073c1a)
(cherry picked from commit 8a99c8a)
…anagers

(cherry picked from commit 5639352)
(cherry picked from commit 9ce961a)
…nstead of String.prototype extensions

(cherry picked from commit 37d69f1)
(cherry picked from commit 58f3bec)
@jasonmit jasonmit changed the title chore: fail test for issue-17529 chore: fail test for each-in not accessing props properly whose keys contain a period Jan 30, 2019
@bekzod
Copy link
Contributor

bekzod commented Jan 31, 2019

@chancancode
Copy link
Member

Seems like the problem is we used to check obj[key] before we even check if key is a path? To fix #17529, we can probably call getPath directly with a single-element array. But is this behavior change in #17166 really okay?

@rwjblue
Copy link
Member

rwjblue commented Feb 16, 2019

We should add some tests if that is actually a thing we intend to support, but to my knowledge we have never "really" supported get(obj, 'foo.bar.baz') finding obj['foo.bar.baz'], have we?

@jasonmit
Copy link
Member Author

jasonmit commented Feb 16, 2019

@rwjblue I haven't found anything detailing this getter path behavior either, so it may have been a bug this app was depending on for a few years.

If we're not supporting it, I'd still like to send over tests so the behavior stays consistent into the future. In our case it was a bit trolly since the keys were not symbolic of a path - they were ISO datetime strings.

@rwjblue
Copy link
Member

rwjblue commented Feb 17, 2019

Ya, I totally agree that we should nail down the specific desired behavior with tests. If for nothing more than to ensure we don’t regress and change behavior again.

@locks locks self-assigned this Apr 19, 2020
@kategengler
Copy link
Member

I'm going to go ahead and close this -- this was unspecified behavior and not an area we want to touch going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants