Skip to content

Commit

Permalink
fix(useBaseQuery): cast enabled to boolean before effect
Browse files Browse the repository at this point in the history
Fixes #702
  • Loading branch information
tannerlinsley committed Jul 3, 2020
1 parent 8efa46c commit 3bbcb9a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/react/useBaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ export function useBaseQuery(queryKey, config = {}) {
instanceRef.current.updateConfig(config)
})

const enabledBool = Boolean(config.enabled)

// Run the instance when the query or enabled change
React.useEffect(() => {
if (config.enabled && query) {
if (enabledBool && query) {
// Just for change detection
}
instanceRef.current.run()
}, [config.enabled, query])
}, [enabledBool, query])

return {
...query,
Expand Down

0 comments on commit 3bbcb9a

Please sign in to comment.