From 58d7f4f729d61e759b52a3d7f229c6aabdf81aba Mon Sep 17 00:00:00 2001 From: Mark Grothe Date: Thu, 13 Oct 2022 10:00:07 -0500 Subject: [PATCH 1/2] fix: fixed dependencies to prevent unecessary re-fetch --- src/hooks/useReservesHistory.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/hooks/useReservesHistory.tsx b/src/hooks/useReservesHistory.tsx index ebc57f5fe1..561179b74e 100644 --- a/src/hooks/useReservesHistory.tsx +++ b/src/hooks/useReservesHistory.tsx @@ -81,20 +81,16 @@ export function useReserveRatesHistory(reserveAddress: string, timeRange: Reserv const [error, setError] = useState(false); const [data, setData] = useState([]); + const ratesHistoryApiUrl = currentNetworkConfig?.ratesHistoryApiUrl; + const refetchData = useCallback<() => () => void>(() => { // reset setLoading(true); setError(false); setData([]); - if ( - reserveAddress && - currentNetworkConfig.ratesHistoryApiUrl && - !BROKEN_ASSETS.includes(reserveAddress) - ) { - const cancelable = makeCancelable( - fetchStats(reserveAddress, timeRange, currentNetworkConfig.ratesHistoryApiUrl) - ); + if (reserveAddress && ratesHistoryApiUrl && !BROKEN_ASSETS.includes(reserveAddress)) { + const cancelable = makeCancelable(fetchStats(reserveAddress, timeRange, ratesHistoryApiUrl)); cancelable.promise .then((data: APIResponse[]) => { @@ -120,7 +116,7 @@ export function useReserveRatesHistory(reserveAddress: string, timeRange: Reserv setLoading(false); return () => null; - }, [reserveAddress, timeRange, currentNetworkConfig]); + }, [reserveAddress, timeRange, ratesHistoryApiUrl]); useEffect(() => { const cancel = refetchData(); From 2d3ce438b76983e7be730ac834646a59a4119347 Mon Sep 17 00:00:00 2001 From: Mark Grothe Date: Thu, 13 Oct 2022 10:48:21 -0500 Subject: [PATCH 2/2] chore: prettier --- .github/actions/fork-result-label/action.yml | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/actions/fork-result-label/action.yml b/.github/actions/fork-result-label/action.yml index 28694ffd7d..f52a5dec41 100644 --- a/.github/actions/fork-result-label/action.yml +++ b/.github/actions/fork-result-label/action.yml @@ -10,31 +10,31 @@ inputs: PULL_REQUEST_NUMBER: description: Pull request id required: false - default: "0" + default: '0' runs: - using: "composite" + using: 'composite' steps: - name: delete success label uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 with: - labels: "CI Passed" - number: ${{ inputs.PULL_REQUEST_NUMBER }} + labels: 'CI Passed' + number: ${{ inputs.PULL_REQUEST_NUMBER }} - name: delete fail label uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 with: - labels: "CI Failed" - number: ${{ inputs.PULL_REQUEST_NUMBER }} + labels: 'CI Failed' + number: ${{ inputs.PULL_REQUEST_NUMBER }} - name: adding success label uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8 if: ${{ inputs.SUCCESS == 'true' }} with: - labels: "CI Passed" - number: ${{ inputs.PULL_REQUEST_NUMBER }} - github_token: ${{ inputs.TOKEN }} + labels: 'CI Passed' + number: ${{ inputs.PULL_REQUEST_NUMBER }} + github_token: ${{ inputs.TOKEN }} - name: adding fail label uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8 if: ${{ inputs.SUCCESS == 'false' }} with: - labels: "CI Failed" - number: ${{ inputs.PULL_REQUEST_NUMBER }} - github_token: ${{ inputs.TOKEN }} + labels: 'CI Failed' + number: ${{ inputs.PULL_REQUEST_NUMBER }} + github_token: ${{ inputs.TOKEN }}