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

[Gateway] remove listener for account change #1689

Conversation

Jennievon
Copy link
Contributor

@Jennievon Jennievon commented Dec 11, 2023

Why this change is needed

Please provide a description and a link to the underlying ticket

https://github.com/ten-protocol/ten-internal/issues/2583

What changes were made as part of this PR

Please provide a high level list of the changes made

  • Remove listener for account change
  • Move the version to the footer
  • Update social links

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

@Jennievon Jennievon requested a review from zkokelj December 11, 2023 13:01
@Jennievon Jennievon self-assigned this Dec 11, 2023
Copy link

coderabbitai bot commented Dec 11, 2023

Walkthrough

The recent updates to the wallet extension involve a reorganization of where version information is displayed and a refinement of the wallet connection logic. The footer now shows the version number, while the connected component no longer does. The wallet provider's initialization process has been improved, particularly in handling the presence of ethereum. Additionally, the project's social media links have been updated to reflect a rebranding from "obscuronet" to "ten-protocol".

Changes

File Path Changes
.../layouts/footer.tsx
.../providers/wallet-provider.tsx
The Footer component now includes the version in the display using useWalletConnection. Removed handleAccountsChanged function and improved initialize function with ethereum check.
.../modules/home/connected.tsx Removed version information display from the Connected component.
.../lib/constants.ts Updated social media links from "obscuronet" to "ten-protocol".

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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.v2.json

Copy link

@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 4eb837e and dcddaa3.
Files selected for processing (3)
  • tools/walletextension/frontend/src/components/layouts/footer.tsx (2 hunks)
  • tools/walletextension/frontend/src/components/modules/home/connected.tsx (2 hunks)
  • tools/walletextension/frontend/src/components/providers/wallet-provider.tsx (2 hunks)
Additional comments: 8
tools/walletextension/frontend/src/components/layouts/footer.tsx (2)
  • 8-11: The import of useWalletConnection and its usage to get the version is consistent with the PR's objective to refactor how version information is displayed.

  • 41-41: The conditional rendering of the version with a fallback to "Unknown" is a good practice to handle cases where version might be undefined or null.

tools/walletextension/frontend/src/components/modules/home/connected.tsx (2)
  • 19-19: The removal of the version variable from the destructuring of the useWalletConnection hook is consistent with the PR's objective to remove the display of version information from the Connected component.

  • 16-22: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [16-88]

After reviewing the entire Connected component, it appears that the removal of the version variable has no adverse effects on the remaining code. The variable is not referenced anywhere else in the component, which suggests that the change is safe and the component should function as expected without displaying version information.

tools/walletextension/frontend/src/components/providers/wallet-provider.tsx (4)
  • 48-54: The addition of the conditional check for ethereum in the initialize function is correct and follows best practices for early return if a required condition is not met.

  • 164-167: The useEffect hook is correctly used to call initialize on component mount. However, ensure that suppressing the linter warning for missing dependencies is intentional and that no dependencies are actually missing from the dependency array.

  • 43-64: While the hunk does not show the removal of the handleAccountsChanged function, it's important to ensure that any code that depended on this function is updated or removed accordingly to prevent potential issues.


#!/bin/bash
# Search for any remaining references to `handleAccountsChanged` to ensure they have been properly updated or removed.
rg 'handleAccountsChanged' src/**/*.tsx
  • 43-64: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [43-171]

The PR overview mentions changes to the Connected and Footer components, which are not part of the provided hunks. Ensure that these changes are consistent with the rest of the codebase and that the useWalletConnection hook is being used correctly in these components.


#!/bin/bash
# Correct the pattern to verify that the `Connected` component no longer destructures the `version` variable.
ast-grep --lang typescript --pattern $'const Connected = {
  $$$
  const { $_, $_, $_, version } = useWalletConnection();
  $$$
}'

# Correct the pattern to verify that the `Footer` component now uses the `useWalletConnection` hook to display the `version`.
ast-grep --lang typescript --pattern $'const Footer = {
  $$$
  const { version } = useWalletConnection();
  $$$
}'

@Jennievon Jennievon changed the title remove listener for account change [Gateway] remove listener for account change Dec 11, 2023
Copy link

@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: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between dcddaa3 and e763993.
Files selected for processing (1)
  • tools/walletextension/frontend/src/lib/constants.ts (1 hunks)

Copy link
Contributor

@zkokelj zkokelj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Jennievon Jennievon merged commit b428c62 into main Dec 11, 2023
1 of 2 checks passed
@Jennievon Jennievon deleted the jennifer/2583-gateway-switching-to-another-account-in-mm-it-reports-an-error-fetching-the-accounts branch December 11, 2023 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants