americanexpress / fetchye

✨ If you know how to use Fetch, you know how to use Fetchye [fetch-yae]. Simple React Hooks, Centralized Cache, Infinitely Extensible.
Apache License 2.0
42 stars 21 forks source link

fix(reduxProvider): dependency array had bad entry #73

Closed Matthew-Mallimo closed 1 year ago

Matthew-Mallimo commented 1 year ago

Description

The dependency array for the useEffect in makeUseFetchyeSelector included a functional reference that was only updated when the key changes. In certain circumstances where data fetching is started by another process (not useFetchye), this useEffect would fail to run once the data was returned.

Implementing this actually reduced the number of renders.

Motivation and Context

This change correctly reruns the useEffect when data has changed.

How Has This Been Tested?

Unit tests, and manual testing.

Types of Changes

Checklist:

What is the Impact to Developers Using Fetchye?

codesandbox-ci[bot] commented 1 year ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit cf4e46218952219670dafc7e696b65cf8816eacd:

Sandbox Source
quick-install Configuration
fetchye-provider-install Configuration
fetchye-redux-provider-install Configuration
nextjs-fetchye-ssr Configuration