-
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
Update instances of fromToken to resolve potential undefined errors #1542
Conversation
WalkthroughThe changes primarily focus on enhancing the code's robustness by introducing optional chaining ( Changes
Poem
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: 2
Configuration used: CodeRabbit UI
Files selected for processing (4)
- packages/synapse-interface/components/StateManagedBridge/BridgeTransactionButton.tsx (1 hunks)
- packages/synapse-interface/components/StateManagedBridge/InputContainer.tsx (2 hunks)
- packages/synapse-interface/pages/state-managed-bridge/index.tsx (9 hunks)
- packages/synapse-interface/slices/bridge/updater.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
- packages/synapse-interface/slices/bridge/updater.tsx
Additional comments: 10
packages/synapse-interface/components/StateManagedBridge/BridgeTransactionButton.tsx (1)
- 80-81: The use of optional chaining (
?.
) here is a good practice to prevent potential null or undefined errors when accessing thedecimals
property offromToken
. This ensures that the code handles cases wherefromToken
orfromToken.decimals[fromChainId]
might be null or undefined.packages/synapse-interface/pages/state-managed-bridge/index.tsx (9)
134-140: The use of optional chaining (
?.
) is a good practice to prevent potential null reference errors. However, it's important to ensure that the logic of the code still holds whenfromToken?.decimals[fromChainId]
isundefined
. Ifundefined
is a valid state and doesn't break the logic, this is fine. Otherwise, you might want to add additional checks.192-196: Again, the use of optional chaining (
?.
) is a good practice to prevent potential null reference errors. However, it's important to ensure that the logic of the code still holds whenfromToken?.decimals[fromChainId]
isundefined
. Ifundefined
is a valid state and doesn't break the logic, this is fine. Otherwise, you might want to add additional checks.211-241: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [211-417]
The changes here are primarily focused on adding optional chaining (
?.
) and nullish coalescing (??
) operators to prevent potential null reference errors. This is a good practice. However, it's important to ensure that the logic of the code still holds when these values areundefined
ornull
. If these are valid states and don't break the logic, this is fine. Otherwise, you might want to add additional checks.
278-286: The use of optional chaining (
?.
) is a good practice to prevent potential null reference errors. However, it's important to ensure that the logic of the code still holds whenfromToken?.decimals[fromChainId]
isundefined
. Ifundefined
is a valid state and doesn't break the logic, this is fine. Otherwise, you might want to add additional checks.298-302: The use of optional chaining (
?.
) is a good practice to prevent potential null reference errors. However, it's important to ensure that the logic of the code still holds whenfromToken?.symbol
isundefined
. Ifundefined
is a valid state and doesn't break the logic, this is fine. Otherwise, you might want to add additional checks.314-320: The use of optional chaining (
?.
) is a good practice to prevent potential null reference errors. However, it's important to ensure that the logic of the code still holds whenfromToken?.symbol
isundefined
. Ifundefined
is a valid state and doesn't break the logic, this is fine. Otherwise, you might want to add additional checks.396-417: The use of optional chaining (
?.
) is a good practice to prevent potential null reference errors. However, it's important to ensure that the logic of the code still holds whenfromToken?.addresses[fromChainId as keyof Token['addresses']]
isundefined
. Ifundefined
is a valid state and doesn't break the logic, this is fine. Otherwise, you might want to add additional checks.421-427: The use of optional chaining (
?.
) is a good practice to prevent potential null reference errors. However, it's important to ensure that the logic of the code still holds whenfromToken?.symbol
isundefined
. Ifundefined
is a valid state and doesn't break the logic, this is fine. Otherwise, you might want to add additional checks.450-456: The use of optional chaining (
?.
) is a good practice to prevent potential null reference errors. However, it's important to ensure that the logic of the code still holds whenfromToken?.symbol
isundefined
. Ifundefined
is a valid state and doesn't break the logic, this is fine. Otherwise, you might want to add additional checks.
packages/synapse-interface/components/StateManagedBridge/InputContainer.tsx
Show resolved
Hide resolved
packages/synapse-interface/components/StateManagedBridge/InputContainer.tsx
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1542 +/- ##
=============================================
Coverage 51.23324% 51.23324%
=============================================
Files 362 362
Lines 24691 24691
Branches 283 283
=============================================
Hits 12650 12650
Misses 10813 10813
Partials 1228 1228
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Summary by CodeRabbit
462f05d930b07df1efbd11d9a977579d8a65f285: synapse-interface preview link