-
Notifications
You must be signed in to change notification settings - Fork 28
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
Tracked storage implementations #161
Tracked storage implementations #161
Conversation
95d437f
to
51f78de
Compare
return createArrayProxy(arr.slice()); | ||
let clone = arr.slice(); | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
let self = this; |
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 using this blast from the past because not all of the proxy hooks have a receiver? or at least my editor didn't say that they did.
If I'm wrong, I'll gladly swap out all the self references to receiver.
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.
Well, for the array case they all do - because the only hooks needed are get
and set
. So there you can use receiver
. But for the object case you're right.
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.
Actually no, you can't use receiver
as it's the Proxy object, not the instance of the class that has the needed methods.
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.
that's why let self = this
🙃
@chriskrycho / @pzuraq these are the failing tests atm, but do these failing tests imply that we need to fix something in tracked-maps-and-sets? once resolved, I think this is ready to go? |
@NullVoxPopuli - are you sure |
Yeah, this library re-exports maps and sets, and uses them in the decorator |
I will try to dig into this PR tomorrow (very full day today!), but at a first pass without even having looked at it, I'd say:
|
|
addon/-private/array.ts
Outdated
let index = convertToInt(prop); | ||
|
||
if (index !== null) { | ||
self.storageFor(index); |
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.
@NullVoxPopuli - shouldn't this be self.readStorageFor(index)
(like in tracked-object
)? And readStorageFor
should also be changed to getValue(storage)
instead of return storage
. Or am I missing something?
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.
it's been a minute, but I think it's just a method naming inconsistency?
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.
Nope, check the similar method in object.ts
. It does getValue(storage)
(which in the array
case it doesn't do).
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.
it does for the collection reference
3d9b55e
to
7e7989b
Compare
Now the implementation looks correct, thanks! A couple of notes:
P.S.
|
I'll take a look as soon as tracked-maps-and-sets is released as that is a dependency for this work to move forward |
@NullVoxPopuli I've released tracked-maps-and-sets v3.0.2, which should unblock this! You'll need to basically run CI locally (or on your own fork) at present, though, as there's something blocking GH Actions on the newly-created org here (I've filed a ticket with GH support, but it's unclear how long it will take to get resolved). Note that this is also a prerequisite for #173. 😩 Lots of pieces in flight here. Let me know when you've rebased and I'll review! |
@NullVoxPopuli @SergeAstapov if need be I can basically fold these two PRs together. |
… assertions from each other
7e7989b
to
e16c492
Compare
Locally,
|
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.
Overall 👍🏻 – bunch of tweaks around privacy, but that's it!
* Ember CLI v2.13 or above | ||
* Node.js v8 or above | ||
* Ember.js v3.23 or above | ||
* Ember CLI v3.23 or above |
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.
Does it actually require a CLI bump? I'd prefer to just leave CLI alone unless there's a reason to change it.
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.
probably not!
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.
but, we aren't testing against ember-cli 2.13
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
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.
Ran CI locally:
------ RESULTS ------
Scenario ember-lts-3.24: SUCCESS
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency │ Expected │ Used │ Type │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source │ 3.24.3 │ 3.24.3 │ yarn │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
Scenario ember-lts-3.28: SUCCESS
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency │ Expected │ Used │ Type │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source │ ~3.28.0 │ 3.28.4 │ yarn │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
Scenario ember-release: SUCCESS
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency │ Expected │ Used │ Type │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source │ https://s3.amazon… │ 3.28.4-release+62976fe7 │ yarn │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
Scenario ember-beta: FAIL
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency │ Expected │ Used │ Type │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source │ https://s3.amazon… │ 4.0.0-beta.5.beta+829c1131 │ yarn │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
Scenario ember-canary: FAIL
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency │ Expected │ Used │ Type │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source │ https://s3.amazon… │ 4.1.0-alpha.2.canary+67d465… │ yarn │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
2 scenarios failed
3 scenarios succeeded
5 scenarios run
This is as expected.
This PR requires: #160 be merged first