-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/reset output #1446
Fix/reset output #1446
Conversation
WalkthroughThe changes introduced in this pull request primarily focus on enhancing the functionality of the Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files selected for processing (2)
- packages/synapse-interface/slices/bridge/reducer.ts (2 hunks)
- packages/synapse-interface/slices/bridge/updater.tsx (3 hunks)
Files skipped from review due to trivial changes (1)
- packages/synapse-interface/slices/bridge/reducer.ts
Additional comments (Suppressed): 3
packages/synapse-interface/slices/bridge/updater.tsx (3)
13-13: The
resetBridgeQuote
function is imported fromreducer.ts
. This function is used to reset thebridgeQuote
state to its initial value when the input is empty.29-29: The
bridgeQuote
variable is added to the destructured variables fromuseBridgeState()
. This variable represents the current bridge quote state.112-116: A new
useEffect
hook is introduced. This hook triggers theresetBridgeQuote
function when thedebouncedFromValue
is equal to its initial state, effectively clearing the bridge quote when the input is empty. This is a good approach to prevent the display of outdated quotes when the input is cleared. However, please verify that theresetBridgeQuote
function correctly resets thebridgeQuote
state to its initial value.+ // Clear bridge quote if input is empty + useEffect(() => { + if (debouncedFromValue === initialState.debouncedFromValue) { + dispatch(resetBridgeQuote()) + } + }, [debouncedFromValue, bridgeQuote])
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1446 +/- ##
=============================================
Coverage 50.69210% 50.69210%
=============================================
Files 356 356
Lines 24274 24274
Branches 267 267
=============================================
Hits 12305 12305
Misses 10775 10775
Partials 1194 1194
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
In the scenario that the user clears the Bridge Input amount around when bridge quotes are returned, this will fix any glitch where the output amount shows a bridge quote for a prior Input amount.
Summary by CodeRabbit
resetBridgeQuote
action to thebridgeSlice
reducer. This action allows thebridgeQuote
state to be reset to its initial value, improving the user experience by ensuring that outdated or incorrect data is not displayed.bridge
updater to import and use theresetBridgeQuote
function. This change enhances the application's responsiveness by clearing the bridge quote when the input is empty, preventing confusion or errors caused by stale data.a6cf17e670fc3032deae9c3b5f8656a8f3a96f1c: synapse-interface preview link