FireworksX / graph-state

Cache state manager.
2 stars 1 forks source link

Don't resolve partial graphs #43

Closed FireworksX closed 3 months ago

FireworksX commented 4 months ago
const state = createState({
  initialState: {
    _type: 'User',
    _id: 'id',
    nested: {
      field: 100
    },
  },
})

state.resolve('User:id')
/* Got correct value
{
  _type: 'User',
  _id: 'id',
  nested: { field: 100, _type: 'User', _id: 'id.nested' }
}
*/

But if i give array return links

const state = createState({
  initialState: {
    _type: 'User',
    _id: 'id',
    nested: [{
      field: 100
    }]
  },
})

state.resolve('User:id') // { _type: 'User', _id: 'id', nested: [ 'User:id.nested.0' ] }
// instead that should return 
// { _type: 'User', _id: 'id', nested: [ { _type: 'User', ... } ] }