Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

number 0 becomes empty atom #460

Closed
quazzie opened this issue Aug 19, 2015 · 2 comments
Closed

number 0 becomes empty atom #460

quazzie opened this issue Aug 19, 2015 · 2 comments
Assignees
Labels

Comments

@quazzie
Copy link

quazzie commented Aug 19, 2015

if i return [{ path: ['test', 1, 'nr'], value: 0 }] from a routers get method the jsonGraph returned has nr as { $type: "atom" } no value.

@sdesai
Copy link
Contributor

sdesai commented Aug 20, 2015

I believe the fix for this is to change this line:

https://github.com/Netflix/falcor-router/blob/master/src/cache/optimizePathSets.js#L34

To be:

if (cache === undefined)

So that we don't inadvertently pick it up as a missing path, and insert the empty atom.

I believe that undefined is the only indicator for "no value" (that is, null is valid value, as is 0, "", false etc. which all currently exhibit the same buggy behavior).

Fixes the issue in my local testing, just figuring out what I need to do to test it more broadly (unit tests, integration tests etc.), and will issue a pull request.

sdesai added a commit to sdesai/falcor-router that referenced this issue Aug 20, 2015
Paths which returned falsey values (null, 0, false, '') were being
treated as missing paths, and hence being returned as empty atoms.

See: Netflix/falcor#460

Added unit tests, and get integration test for these falsey value
cases.
@sdesai
Copy link
Contributor

sdesai commented Aug 25, 2015

Closing this. It's fixed/merged. Forgot to include the issue reference in the commit/PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants