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: [Recovery] lazy-load based on feature toggle #3044

Merged
merged 5 commits into from
Dec 22, 2023
Merged

Conversation

katspaugh
Copy link
Member

What it solves

Resolves #3035

How this PR fixes it

  • I've changed the RecoveryContext to an external store to be able to lazy-load it – lazy-loading a React context provider re-renders the entire app
  • It will be not loaded if the feature is disabled
  • It's now code-split into its own chunk
Screenshot 2023-12-20 at 15 09 57

@katspaugh katspaugh requested a review from iamacook December 20, 2023 14:12
Copy link

github-actions bot commented Dec 20, 2023

Branch preview

✅ Deploy successful!

https://lazy_recovery--walletweb.review-wallet-web.5afe.dev

Copy link

github-actions bot commented Dec 20, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented Dec 20, 2023

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 1.33 MB (🟢 -127.38 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Six Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/addOwner 4.06 KB (🟡 +607 B) 1.34 MB
/home 23.51 KB (🟢 -37.58 KB) 1.36 MB
/settings/modules 13.35 KB (🟡 +684 B) 1.35 MB
/settings/security-login 28.87 KB (🟢 -17.76 KB) 1.36 MB
/settings/setup 36.73 KB (🟡 +460 B) 1.37 MB
/transactions/queue 19.47 KB (🟢 -7.36 KB) 1.35 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

github-actions bot commented Dec 20, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
77.77% (+0.05% 🔼)
11305/14536
🔴 Branches
53.91% (+0.12% 🔼)
2413/4476
🟡 Functions
61.7% (+0.11% 🔼)
1743/2825
🟡 Lines
79.1% (+0.03% 🔼)
10217/12916
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / useRecovery.ts
100% 50% 100% 100%
🟢
... / SendToBlock.tsx
80% 0% 0% 100%
🟢
... / index.tsx
83.33% 100% 33.33% 82.61%
🟢
... / RecoveryContextHooks.tsx
100% 100% 100% 100%
🟢
... / useIsRecoverySupported.ts
100% 100% 100% 100%
🟢
... / index.tsx
96.88% 100% 100% 100%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / useRecoveryTxState.ts
100%
92.86% (-7.14% 🔻)
100% 100%
🟡
... / PendingTxsList.tsx
61.7% (-1.34% 🔻)
36.36% (+3.03% 🔼)
23.08% (-6.92% 🔻)
64.44% (-1.46% 🔻)

Test suite run success

1345 tests passing in 184 suites.

Report generated by 🧪jest coverage report action from 544d250

const [recoveryState, recoveryStateError, recoveryStateLoading] = useRecoveryState(delayModifiers)
const pending = useRecoveryPendingTxs()

useRecoverySuccessEvents(pending, recoveryState)
Copy link
Member Author

Choose a reason for hiding this comment

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

This hook is apparently used for side effects and it shouldn't be in a store intializer...

@katspaugh
Copy link
Member Author

katspaugh commented Dec 21, 2023

@francovenica FYI I've run the regression suite on this branch, it's all green ✅

@iamacook
Copy link
Member

All looks good to me but as it touches every area of recovery, I think it would be wise to do a full regression test of the feature.

@katspaugh katspaugh changed the title Refactor: lazy-load Recovery based on feature toggle Refactor: [Recovery] lazy-load based on feature toggle Dec 21, 2023
@francovenica
Copy link
Contributor

LGTM

Checked in sepolia that I can enable/disable the feature in the django admin

Did a smoke on the feature on a sepolia safe and it works fine.

@katspaugh katspaugh merged commit 41bc048 into dev Dec 22, 2023
15 checks passed
@katspaugh katspaugh deleted the lazy-recovery branch December 22, 2023 07:57
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@liliya-soroka
Copy link
Member

the full regression for the Recovery feature is required according to @iamacook .
I will move it back to QA for the deep testing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lazy-load Recovery
4 participants