-
Notifications
You must be signed in to change notification settings - Fork 5.5k
chore: simplify empty state component #39637
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
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (2 files, +3 -12)
|
ui/components/app/transaction-activity-empty-state/transaction-activity-empty-state.test.tsx
Outdated
Show resolved
Hide resolved
385a68f to
6849c02
Compare
Builds ready [6849c02]
UI Startup Metrics (1340 ± 122 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
| groupedCompletedTransactions.length === 0 ? ( | ||
| <TransactionActivityEmptyState | ||
| className="mx-auto mt-5 mb-6" | ||
| account={selectedAccount} |
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.
Remove the need to pass account to an Empty state component
ui/components/app/transaction-activity-empty-state/transaction-activity-empty-state.test.tsx
Outdated
Show resolved
Hide resolved
Builds ready [a514667]
UI Startup Metrics (1258 ± 119 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
ui/components/app/transaction-activity-empty-state/transaction-activity-empty-state.test.tsx
Show resolved
Hide resolved
Builds ready [09a5a06]
UI Startup Metrics (1323 ± 131 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [7801794]
UI Startup Metrics (1335 ± 116 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Reduce selector based re-render by encapsulating the useSelector usage into the component [](https://codespaces.new/MetaMask/metamask-extension/pull/39637?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk UI refactor that removes a prop and relies on an existing selector for the selected internal account; primary risk is runtime issues if state shape differs in edge cases or tests/stories not providing required Redux state. > > **Overview** > `TransactionActivityEmptyState` no longer accepts an `account` prop and instead selects the active internal account via `getSelectedInternalAccount`, encapsulating the swap-enable logic inside the component. > > All call sites in `transaction-list` and `unified-transaction-list` are updated to render the empty state without passing `selectedAccount`, and Storybook/tests are adjusted to remove the mock account prop and to set up `internalAccounts.selectedAccount`/`accounts` in mocked Redux state. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7801794. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Description
Reduce selector based re-render by encapsulating the useSelector usage into the component
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk UI refactor that removes a prop and relies on an existing selector for the selected internal account; primary risk is runtime issues if state shape differs in edge cases or tests/stories not providing required Redux state.
Overview
TransactionActivityEmptyStateno longer accepts anaccountprop and instead selects the active internal account viagetSelectedInternalAccount, encapsulating the swap-enable logic inside the component.All call sites in
transaction-listandunified-transaction-listare updated to render the empty state without passingselectedAccount, and Storybook/tests are adjusted to remove the mock account prop and to set upinternalAccounts.selectedAccount/accountsin mocked Redux state.Written by Cursor Bugbot for commit 7801794. This will update automatically on new commits. Configure here.