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

Returning a null value throws an exception #120

Closed
dallonf opened this issue Aug 21, 2015 · 6 comments
Closed

Returning a null value throws an exception #120

dallonf opened this issue Aug 21, 2015 · 6 comments
Assignees

Comments

@dallonf
Copy link

dallonf commented Aug 21, 2015

If you return a null value like this:

{path: ['hello'], value: null}

The Router will throw an error:

TypeError: Cannot read property '$type' of null
    at pathValueMerge (C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\src\cache\pathValueMerge.js:22:29)
    at C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\src\run\mergeCacheAndGatherRefsAndInvalidations.js:37:29
    at Array.forEach (native)
    at mergeCacheAndGatherRefsAndInvalidations (C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\src\run\mergeCacheAndGatherRefsAndInvalidations.js:24:16)
    at C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\src\run\recurseMatchAndExecute.js:73:45
    at C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\node_modules\rx\dist\rx.js:4924:20
    at C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\node_modules\rx\dist\rx.js:4785:51
    at tryCatcher (C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\node_modules\rx\dist\rx.js:567:29)
    at InnerObserver.onNext (C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\node_modules\rx\dist\rx.js:4806:43)
    at InnerObserver.tryCatcher (C:\Users\DallonF\devroot\nuve-web\node_modules\falcor-router\node_modules\rx\dist\rx.js:567:29)

I expect this has to do with JavaScript's typeof null == 'object' shenanigans. I could probably fix this, just wanted to record it in case somebody can get to it before I can.

@jhusain
Copy link
Contributor

jhusain commented Aug 21, 2015

@michaelbpaulson can you take a look at this?

@sdesai
Copy link
Contributor

sdesai commented Aug 21, 2015

This may be fixed by the PR for: Netflix/falcor#460

Has a similar smell [ falsey values being treated as missing paths ]

@sdesai
Copy link
Contributor

sdesai commented Aug 21, 2015

Just looked at the strack trace - has a different root cause. Added a (pending) test for it, with the PR above, and will look into a fix.

@jhusain
Copy link
Contributor

jhusain commented Aug 21, 2015

@michaelbpaulson Can we push this to NPM?

JH

On Aug 21, 2015, at 3:07 PM, Michael Paulson notifications@github.com wrote:

Closed #120 via #122.


Reply to this email directly or view it on GitHub.

@ThePrimeagen
Copy link
Contributor

@jhusain Well, we really need a way to track this via change logs. When we release we just have a new version with no reasoning for why the new version is needed. But ill release it. We should strongly consider getting changelists before any more active dev is done.

@ThePrimeagen
Copy link
Contributor

v0.2.9 pushed to github / npm.

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

No branches or pull requests

4 participants