Netflix / falcor

A JavaScript library for efficient data fetching

Home Page:http://netflix.github.io/falcor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug computing ツabsolutePath in set for nodes after following a reference

trxcllnt opened this issue · comments

Found a bug in set when computing optimized paths for nodes set after following a reference.

Click here to see repro code

var model = new falcor.Model();

model._setJSONGs(model, [{
  paths: [
    ['genrelist', [0, 1], 'titles', 0, 'name']
  ],
  jsonGraph: {
    genrelist: {
      0: { titles: { 0: { $type: 'ref', value: ['titlesById', 32] } } },
      1: { titles: { 0: { $type: 'ref', value: ['titlesById', 87] } } }
    }
  },
  titlesById: {
    32: { name: 'Die Hard' },
    87: { name: 'How to Lose a Guy in Ten Days' }
  }
}]);

var cache = model._root.cache;

console.log(JSON.stringify(cache.genrelist[0].ツabsolutePath)); // <-- ["genrelist",0]
console.log(JSON.stringify(cache.genrelist[1].ツabsolutePath)); // <-- ["name", 1], should be ["genrelist",1]