Skip to content

Fixes: Requested keys of a value that is not an object.#143

Merged
ryanbrainard merged 7 commits intoheroku:masterfrom
PriteshJain:master
Aug 8, 2016
Merged

Fixes: Requested keys of a value that is not an object.#143
ryanbrainard merged 7 commits intoheroku:masterfrom
PriteshJain:master

Conversation

@PriteshJain
Copy link
Copy Markdown
Contributor

Requested keys of a value that is not an object.
in shallowEqual

Recently I was trying hands on React native and while using this util found the below error. I have tried to fix in this pull request. It adds some extra checks before doing shallowEqual.

Requested keys of a value that is not an object.
shallowEqual
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:79135:22
<unknown>
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:78825:33
<unknown>
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:78824:54
<unknown>
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:78920:34
refetchDataFromMappings
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:78910:30
refetchDataFromProps
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:78903:29
componentWillReceiveProps
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:78875:26
updateComponent
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:17900:31
receiveComponent
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:17833:21
receiveComponent
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16003:34
updateChildren
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:17111:33
_reconcilerUpdateChildren
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16692:36
_updateChildren
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16794:48
updateChildren
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16782:21
receiveComponent
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:14069:20
receiveComponent
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16003:34
_updateRenderedComponent
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:18036:33
_performComponentUpdate
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:18014:30
updateComponent
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:17933:29
performUpdateIfNecessary
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:17847:21
performUpdateIfNecessary
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16037:42
runBatchedUpdates
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:15641:41
perform
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16383:16
perform
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16383:16
perform
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:15580:38
flushBatchedUpdates
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:15663:20
closeAll
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16449:19
perform
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:16396:14
batchedUpdates
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:32294:20
batchedUpdates
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:15588:32
_receiveRootNodeIDEvent
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:14345:28
receiveTouches
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:14407:48
__callFunction
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:7071:28
<unknown>
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:6972:22
guard
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:6919:3
callFunctionReturnFlushedQueue
    index.android.bundle?platform=android&dev=true&hot=false&minify=false:6971:6

Requested keys of a value that is not an object.
in shallowEqual
@PriteshJain
Copy link
Copy Markdown
Contributor Author

removed extra semicolon.

@ryanbrainard
Copy link
Copy Markdown
Contributor

@nfcampos you did a lot of the work on shallow comparisons. See anything this would break? Either way, some tests should be added.

Comment thread src/utils/shallowEqual.js Outdated
}

if (objA === undefined || objB === undefined) {
if (objA === undefined || objB === undefined ||
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if objA is undefined then typeof objA won't be 'object' so there's no need to check for both, just remove the === undefined check

@nfcampos
Copy link
Copy Markdown
Contributor

nfcampos commented Aug 5, 2016

seems fine other than my comment

@ryanbrainard
Copy link
Copy Markdown
Contributor

Good point.

On Friday, August 5, 2016, Nuno Campos notifications@github.com wrote:

seems fine other than my comment


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#143 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA7AbMYwbCxlokRglItnB8J3XFAhVSJYks5qcv-_gaJpZM4JbFr1
.

@PriteshJain
Copy link
Copy Markdown
Contributor Author

PriteshJain commented Aug 7, 2016

@ryanbrainard @nfcampos I have updated the code removed undefined check and added few test cases for null and undefined check. Let me know if I can help in any other way.

Requested keys of a value that is not an object. in shallowEqual
@ryanbrainard
Copy link
Copy Markdown
Contributor

Thanks!

@ryanbrainard ryanbrainard merged commit 8ae2729 into heroku:master Aug 8, 2016
@ryanbrainard
Copy link
Copy Markdown
Contributor

Released: https://github.com/heroku/react-refetch/releases/tag/v1.0.0-beta.9

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

Successfully merging this pull request may close these issues.

3 participants