MojitProxy Refresh View throwing error on Mojito 0.5.0 #843

Closed
maumunoz opened this Issue Dec 6, 2012 · 3 comments

Comments

Projects
None yet
2 participants

maumunoz commented Dec 6, 2012

When executing a Refresh View, I'm getting a Javascript error:

Uncaught TypeError: Cannot read property 'nodeType' of null

It is thrown on mojito-client.client.js (line 96):

    var newNode = Y.Node.create(viewData);
    mp._node.replace(newNode);
    mp._element = document.getElementById(mp._viewId);
    mp._node = new Y.Node(mp._element);

new Y.Node(mp._element) is throwing an error because mp._element is null. Digging more in the problem it seems to be related to the id replacement logic. Instance Id from meta and the current mojit have to match (mBinder.instanceId === clientMojit.proxy._instanceId) but that is not the case. Since no replacement is made, the code is looking for the old view id which doesn't exist anymore.

I wrote a very simple application to test the refresh view:

https://github.com/maumunoz/Mojito-Refresh-View-Test

This application works on Mojito 0.4.9-2, but not on 0.5.0

Collaborator

caridy commented Dec 6, 2012

@maumunoz thanks for the repro-case, I will look into it.

Collaborator

caridy commented Dec 6, 2012

I can confirm that this issue is related to issue #843, and @drewfish is working on a fix for 0.5.1.

The instanceId sent to the /tunnel should be used as part of the binder map that is part of the response. The issue is introduced by the expandInstance routine, which is creating a new id everytime to avoid bleeding.

@drewfish drewfish added a commit to drewfish/mojito that referenced this issue Dec 7, 2012

@drewfish drewfish added test for problem found in issue #843 a82128c
Collaborator

caridy commented Dec 7, 2012

I can confirm that this issue was solved by PR #845

caridy closed this Dec 7, 2012

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