Skip to content
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

Handles unloaded origin chain #1532

Merged
merged 1 commit into from
Nov 6, 2023
Merged

Handles unloaded origin chain #1532

merged 1 commit into from
Nov 6, 2023

Conversation

abtestingalpha
Copy link
Collaborator

@abtestingalpha abtestingalpha commented Nov 3, 2023

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling in the ToTokenListOverlay component to prevent crashes when certain data is unavailable.
    • Enhanced the calculation of estimated transaction time to handle cases where certain data is not available, ensuring the app's stability.

654c9c3d06e707e38488376ece9e9956a968fb4c: synapse-interface preview link

Copy link
Contributor

coderabbitai bot commented Nov 3, 2023

Walkthrough

The changes primarily focus on enhancing the code's robustness by implementing optional chaining in two files. This update ensures that the code doesn't throw an error when certain properties are undefined, improving the overall stability of the application.

Changes

File Path Summary
.../StateManagedBridge/ToTokenListOverlay.tsx The originTokenAddress property is now accessed using optional chaining (fromToken?.addresses[fromChainId]), ensuring the code doesn't break when fromToken is undefined.
.../utils/calculateEstimatedTransactionTime.tsx The originChain variable is now accessed using optional chaining (originChain?.blockTime), preventing errors when originChain is null or undefined.

Poem

🍂 As autumn leaves gently fall,
Code changes we do install.
With optional chaining in our sight,
We make our code error-free and light.
🐇 Hop, hop, goes the CodeRabbit,
Celebrating the code, a healthy habit.
In the spirit of the season's grace,
We ensure no error leaves a trace. 🍁


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4f4ef6f and 3f542c2.
Files selected for processing (2)
  • packages/synapse-interface/components/StateManagedBridge/ToTokenListOverlay.tsx (1 hunks)
  • packages/synapse-interface/utils/calculateEstimatedTransactionTime.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/synapse-interface/utils/calculateEstimatedTransactionTime.tsx
Additional comments: 1
packages/synapse-interface/components/StateManagedBridge/ToTokenListOverlay.tsx (1)
  • 272-278: The use of optional chaining here is a good practice to prevent potential errors when fromToken is undefined. However, ensure that the function calculateEstimatedTransactionTime can handle a potential undefined value for originTokenAddress.

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (060df78) 51.57449% compared to head (3f542c2) 51.23324%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #1532         +/-   ##
===================================================
- Coverage   51.57449%   51.23324%   -0.34125%     
===================================================
  Files            372         362         -10     
  Lines          25532       24691        -841     
  Branches         281         283          +2     
===================================================
- Hits           13168       12650        -518     
+ Misses         11074       10813        -261     
+ Partials        1290        1228         -62     
Flag Coverage Δ
cctp-relayer ?
packages 91.00610% <100.00000%> (+0.12511%) ⬆️
promexporter ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
packages/sdk-router/src/operations/bridge.ts 100.00000% <100.00000%> (ø)
packages/sdk-router/src/router/routerSet.ts 95.55556% <ø> (ø)
...ages/sdk-router/src/router/synapseCCTPRouterSet.ts 100.00000% <100.00000%> (ø)
packages/sdk-router/src/router/synapseRouterSet.ts 100.00000% <100.00000%> (ø)
packages/sdk-router/src/router/types.ts 88.88889% <ø> (ø)
packages/sdk-router/src/sdk.ts 100.00000% <100.00000%> (ø)

... and 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3f542c2
Status: ✅  Deploy successful!
Preview URL: https://09b29942.sanguine.pages.dev
Branch Preview URL: https://fe-fromtoken-fix.sanguine.pages.dev

View logs

@abtestingalpha abtestingalpha merged commit 0044808 into master Nov 6, 2023
43 checks passed
@abtestingalpha abtestingalpha deleted the fe/fromToken-fix branch November 6, 2023 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants