Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#11621 closed defect (fixed)

Tree w/JRS store no longer working

Reported by: bill Owned by: Kris Zyp
Priority: high Milestone: 1.6
Component: DojoX Data Version: 1.5
Keywords: Cc:
Blocked By: Blocking:

Description

[22495] seems to have exposed a problem with JsonRestStore, and Tree w/JsonRestStore is no longer working (it does work in 1.5 though).

The first issue is that opening "node 1.1" in the Tree_with_JRS.html test case causes an

this.onSet(node1.1, "id", undefined, "node1.1")

call in JsonRestStore.js, even though the node1.1 item hasn't changed.

That causes the ForestStoreModel code to call requeryTop() (thanks to [22495]), which causes the second problem.

The root problem is that node1.1 initially has a placeholder for children:

{ id: 'node1.1',name:'node1.1', someProperty:'somePropertyA1', children: true}

Then it's correct:

{ id: 'node1.1',name:'node1.1', someProperty:'somePropertyA1', children: [
			{ $ref: 'node1.1.1', name: 'node1.1.1'},
			{ $ref: 'node1.1.2', name: 'node1.1.2'}
]}

But then at some point children's value is switched back to the placeholder:

{ id: 'node1.1',name:'node1.1', someProperty:'somePropertyA1', children: true}

At that point TreeStoreModel.getChildren() returns true instead of an array of items, and everything falls apart.

Change History (9)

comment:1 Changed 9 years ago by bill

(In [22756]) Comment out Tree_with_JRS test until #11621 is fixed, refs #11621. Please uncomment when the bug is fixed.

comment:2 Changed 9 years ago by azawacki

I believe that I can replicate ticket #11621. I also think I can replicate the issue without using the Tree widget, which makes it easier to trackdown what is happening.

http://jzdocs.com/azawacki/RemoteHome.html has a very thin example of the issue.

As I continue to drill down, I think the bug is somwhere within JsonRest?.js in either the query function or in the _loader function.

My belief is that when you have a tree structure that looks something like this:

{id: "obj1", name: "obj1", children: [{$ref: "obj3"}, {$ref: "obj2", name: "obj2"}]} {id: "obj3", name: "obj3"} {id: "obj2", name "obj2", children: [{$ref: "obj3"}]}

I think when obj1 is fetched, the children are examined. The obj3 reference has to be expanded because the name attribute is not provided, but obj2 is not required. So at this point, both obj1 and obj3 have been loaded successfully. Now, when obj2 is fetched, it's reference to obj3 replaces the loaded version of obj3. Now, if you try to access obj3 "properly" using the store, the store recognizes that it's unloaded, and it is refetched and stored successfully, so the fetches to the server look like: fetch obj1 fetch obj3 fetch obj2 <== replaces the "fetched" obj3 with a reference to obj3, needing to be loaded again fetch obj3 <== unnecessary fetch.

In the Tree example, for some reason, when the tree goes to process the children of obj3, I believe it happens between the fetch obj2 and fetch obj3, and during that time, the children of obj3 is set to true rather than the correct values, causing the tree to crash. Perhaps the tree "knows" that obj3 was loaded previously, and wasn't expecting the object to be unloaded. That's completely a guess.

As I understand the problem, the fix would be to examine the cache of items to see if any of the references within the object are already loaded and replace the references with real objects immediately rather than loading the object references into the index.

The actual cause of the problem could be in dojox.json.ref or in dojox.rpc.

Please let me know if I can do anything to help do problem determination.

comment:3 Changed 9 years ago by Kris Zyp

(In [23365]) Fixing issues with the Tree_with_JRS test, refs #11621

comment:4 Changed 9 years ago by Kris Zyp

Does this commit fix the issue?

comment:5 Changed 9 years ago by bill

I tried running the test and get a failure about "node not found", gets stuck in firebug, is it working for you?

comment:6 Changed 9 years ago by Kris Zyp

(In [23367]) Fixing issues with the Tree_with_JRS test, refs #11621

comment:7 Changed 9 years ago by bill

Milestone: tbd1.6
Resolution: fixed
Status: newclosed

Cool, that's working now, thanks!

comment:8 Changed 9 years ago by bill

(In [23368]) Re-enable test now that #11621 is fixed, refs #11621.

comment:9 Changed 8 years ago by bill

In [26547]:

remove obsolete comment, refs #11621

Note: See TracTickets for help on using tickets.