This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Batch Viewer] Avoid multiple requests to Tenderly API (#128)
* Remove unused useRef * Add undefined type to orders * usePreviousValue to detect any changes * Remove usePrevious function in volumeChart and replace with usePrevious hook * Add comment to clarify why the workaround is needed
- Loading branch information
Showing
3 changed files
with
48 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useEffect, useRef } from 'react' | ||
|
||
export function usePrevious<T>(value: T): T | undefined { | ||
const ref = useRef<T>() | ||
|
||
useEffect(() => { | ||
ref.current = value | ||
}, [value]) | ||
|
||
return ref.current | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters