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

refactor(popup/ConnectWalletForm): reduce reliance on browser APIs #588

Merged
merged 3 commits into from
Sep 12, 2024

Conversation

sidvishnoi
Copy link
Member

@sidvishnoi sidvishnoi commented Sep 11, 2024

Context

#565 introduces some more validation. So simplifying this component to make it more testable.

Changes proposed in this pull request

  • Remove this component's reliance on localStorage (replace with defaultValues and onChange props).
  • Remove reliance from browser.runtime.sendMessage/useMessage (replace with connectWallet prop)
  • Remove reliance on fetch/getWalletInformation (replace with getWalletInfo prop)
  • Trigger saving to local storage onBlur instead of onChange with debounce (tested Linux/Mac Chrome/Firefox combo)
  • Prefix localStorage keys with connect.

@github-actions github-actions bot added the area: popup Improvements or additions to extension popup label Sep 11, 2024
Copy link
Contributor

github-actions bot commented Sep 11, 2024

Extension builds preview

Name Link
Latest commit 1632027
Latest job logs Run #10813962922
BadgeDownload
BadgeDownload

@sidvishnoi sidvishnoi marked this pull request as ready for review September 11, 2024 09:46
@sidvishnoi sidvishnoi changed the title refactor(popup/ConnectWalletForm): add props to make it more testable refactor(popup/ConnectWalletForm): reduce reliance on browser APIs Sep 11, 2024
walletAddressUrl:
localStorage?.getItem('connect.walletAddressUrl') || undefined,
}}
onChange={(key, val) => {
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking about giving this a better name. Something like saveToStorage.

src/popup/pages/Settings.tsx Show resolved Hide resolved
src/popup/pages/Settings.tsx Show resolved Hide resolved
@sidvishnoi sidvishnoi merged commit a21d603 into main Sep 12, 2024
8 checks passed
@sidvishnoi sidvishnoi deleted the refactor/setup-page branch September 12, 2024 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: popup Improvements or additions to extension popup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants