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

fix - loss of context #322

Merged
merged 6 commits into from
May 7, 2018
Merged

fix - loss of context #322

merged 6 commits into from
May 7, 2018

Conversation

noobiek
Copy link
Contributor

@noobiek noobiek commented May 6, 2018

Fix proposed for #321

@akre54
Copy link
Contributor

akre54 commented May 6, 2018

Failing tests due to old node. Do the tests pass on your machine?

@noobiek
Copy link
Contributor Author

noobiek commented May 6, 2018

No, I can't npm install / yarn.
I get error hawk@0.10.2: The engine "node" is incompatible with this module. Expected version "0.8.x".
I got node v.9.11.1. Sorry.

@akre54
Copy link
Contributor

akre54 commented May 6, 2018

I just pushed up a few changes to master that should upgrade the packages to their latest version (and fix travis).

Try pulling down master and trying again. If that still doesn't work run npm install --ignore-engines or yarn --ignore-engines.

Also can you add a test case for this? One that would fail without this patch applied? Thanks!

@noobiek
Copy link
Contributor Author

noobiek commented May 7, 2018

Yarn gives me --- error An unexpected error occurred: "https://unpm.uberinternal.com/grunt-contrib-jshint/-/grunt-contrib-jshint-1.1.0.tgz: Request failed "401 Unauthorized"". ---
So I removed yarn.lock and reinstalled all dependencies.
Tests now run just fine. I'll think of a test for our case.

@akre54
Copy link
Contributor

akre54 commented May 7, 2018

I just removed the yarn.lock file from master. Feel free to go without it.

@noobiek
Copy link
Contributor Author

noobiek commented May 7, 2018

Ok. This may be a little tricky to explain what happens.
We have 1 prototype of view, 2 descendatns (view1 and view2), 2 models (model1 and model2).

In the onGet() we push current "this.cid" to "var thises=[]" (actually a little more than that, but that was for console.log() convinience to check what happenes).

Push to "thises" happens after
start = true;
model1.set({'water':'model1'})
model2.set({'water':'model2'})

So basically we expect "thises" to have 2 different cid's.
Without the fix we have there 2 equal cid's of view2. console.log(thises) gives us:
[Object{model: 'model1', view_cid: 'view277'}, Object{model: 'model2', view_cid: 'view277'}]

After the fix we have correct cid's of view1 and view2. consoloe.log(thises) gives us:
[Object{model: 'model1', view_cid: 'view276'}, Object{model: 'model2', view_cid: 'view277'}]

Let me know if anything is not clear.

@noobiek
Copy link
Contributor Author

noobiek commented May 7, 2018

also, why not use the existing window.view like the rest of the tests?

If I understand the issue correctly, we need 2 views with same bindings in same proto.
I might be wrong here, but I was not able to reproduce the issue with views of different prototypes.

@akre54
Copy link
Contributor

akre54 commented May 7, 2018

Few minor fixes then lgtm

@noobiek
Copy link
Contributor Author

noobiek commented May 7, 2018

I am not quite used to github, so I didn't notice your comments were actually for exact lines. So I misunderstood some. Let me know if now I got this right.

@noobiek
Copy link
Contributor Author

noobiek commented May 7, 2018

Maybe this new version is easier to understand?

@akre54
Copy link
Contributor

akre54 commented May 7, 2018

Looks good to me. Thanks for adding the tests :)

@akre54 akre54 merged commit faad0f2 into nytimes:master May 7, 2018
@noobiek
Copy link
Contributor Author

noobiek commented May 7, 2018

My pleasure, @akre54 , thanks for the beautiful lib!

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

Successfully merging this pull request may close these issues.

2 participants