Falcor returning un-wanted atoms?

114 views Asked by At

I'm doing some experimentation with Falcor (falcor-router), and wondering why it sometimes returns 'atom' values.

For example I'm asking for this path: ['items',{from: 0, to: 100},['name', 'value']]

Only 50 items exist for this path, so the only paths items.0..50 are populated.

The resulting jsonGraph contains the correct values for items.0..50, but also contains values for items.51..100 that look like this:

51: { name: { type: "$atom" }, value: { type: "$atom" } }

I would expected that items.51..100 would not be present in the jsonGraph instead of being populated with these atom values.

Why is this happening and what can I do to avoid it?

1

There are 1 answers

0
ptaylor On

Presently routes which produce no data are materialized to empty atoms so the client knows that those values truly are undefined (as opposed just not cached yet).

The JSONGraph merge needs to handle the case that the response may be only a subset of the paths that were requested. If you request for three paths, but the JSONGraph response only has data for two of the paths, the JSONGraph merge knows that there's still one left, and retries the request (but only for the missing path). This process is repeated until we've hit our retry limit, or we've received data for all the paths requested.

So materializing is our way of letting the cache know that it shouldn't build missing paths and re-request for this data.

I believe we have a plan to move away from materializing soon, and only communicate the paths for which no data was returned.

https://github.com/Netflix/falcor-router/issues/189#issuecomment-247722403