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

Updating Text component to use TS Box #19949

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Jul 10, 2023

Explanation

Currently, the Text component is using the deprecated JavaScript version of the Box component. This blocks the TypeScript migration of the extension AND causes issues with the polymorphic as prop. This PR updates the Text component to use the TypeScript version of the Box and moves the old version of Text to text/deprecated folder and updates all imports across the extension.

Why not just update the Text component with Box if the API is the same?

I have another PR open doing just that but because of undiagnosable e2e test failures, I have resorted to this route. I will then subsequently update all import paths folder by folder to point to the updated component. This has proven to be a successful method in the past(thanks @brad-decker and @DDDDDanica 😁). It reduces the impact on engineers and merge conflicts and will help get to the bottom of the e2e test failures if they exist or if it's just an annoying timeout.

This PR also unblocks 9 contributor PRs migrating components to TypeScript

Screenshots/Screencaps

Before

Text component in develop branch in storybook

before.mov

Deprecation message for deprecated Text component

Screenshot 2023-07-12 at 12 31 04 PM

After

Showing updated Text component in storybook using the TS version of the Box component. Showing no visual regressions and all stories and controls are working as expected. I have made some small updates to more easily find the replace Typography with Text section and linked the issue

after.mov

Manual Testing Steps

To check storybook

  • Go to the latest build of storybook in this PR
  • Search Text in the search panel
  • Check the controls, stories and docs are working as expected.

To check all import paths have been updated correctly.

  • The classNames of the 2 Text components are slightly different one uses the TypeScript Box and has the className mm-box vs the JavaScript version box-. SO this means that any snapshot tests will pick this up. There should be NO snapshot test updates with this update in this PR

I also did a search for <Text and part of the new import path text/deprecated to compare the number of files
165 files vs 164 files for .js files with the 1 difference being a comment in a deprecation message

Screenshot 2023-07-12 at 1 10 13 PM
Screenshot 2023-07-12 at 1 10 19 PM
Screenshot 2023-07-12 at 1 10 09 PM

11 files vs 11 files for .tsx files

Screenshot 2023-07-12 at 1 12 41 PM
Screenshot 2023-07-12 at 1 12 47 PM

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@github-actions
Copy link
Contributor

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.

@georgewrmarshall georgewrmarshall force-pushed the fix/19569/deprecate-old-text-add-new branch 4 times, most recently from 9ef3eb6 to 2e5a170 Compare July 12, 2023 19:45
Comment on lines +29 to +32
/**
* @deprecated This version of the `<Text />` component has been deprecated
* Use `import { Text } from '../../component-library';` instead
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding deprecation notice to old version of Text component

@georgewrmarshall georgewrmarshall marked this pull request as ready for review July 12, 2023 20:16
@georgewrmarshall georgewrmarshall requested review from a team as code owners July 12, 2023 20:16
@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Extension label Jul 12, 2023
@georgewrmarshall georgewrmarshall self-assigned this Jul 12, 2023
@metamaskbot
Copy link
Collaborator

Builds ready [2e5a170]
Page Load Metrics (1608 ± 55 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1102041372311
domContentLoaded14121887160811455
load14131887160811455
domInteractive14121887160811455
Bundle size diffs
  • background: 0 bytes
  • ui: 13275 bytes
  • common: 0 bytes

brad-decker
brad-decker previously approved these changes Jul 12, 2023
Copy link
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

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

👏🏻 LGTM

garrettbear
garrettbear previously approved these changes Jul 12, 2023
DDDDDanica
DDDDDanica previously approved these changes Jul 13, 2023
@georgewrmarshall georgewrmarshall force-pushed the fix/19569/deprecate-old-text-add-new branch from b5ce5e1 to 75cf2f6 Compare July 13, 2023 22:00
@metamaskbot
Copy link
Collaborator

Builds ready [75cf2f6]
Page Load Metrics (1755 ± 109 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1093681756531
domContentLoaded140622811754226109
load140622811755226109
domInteractive140622811754226109
Bundle size diffs
  • background: 0 bytes
  • ui: 13275 bytes
  • common: 0 bytes

@georgewrmarshall georgewrmarshall force-pushed the fix/19569/deprecate-old-text-add-new branch from 75cf2f6 to 858b0cb Compare July 13, 2023 23:17
@georgewrmarshall georgewrmarshall force-pushed the fix/19569/deprecate-old-text-add-new branch from 858b0cb to 5213d0a Compare July 14, 2023 15:20
@metamaskbot
Copy link
Collaborator

Builds ready [5213d0a]
Page Load Metrics (1527 ± 32 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1073021334019
domContentLoaded1405169515266732
load1405169515276732
domInteractive1405169515266732
Bundle size diffs
  • background: 0 bytes
  • ui: 13275 bytes
  • common: 0 bytes

@codecov
Copy link

codecov bot commented Jul 14, 2023

Codecov Report

Merging #19949 (5213d0a) into develop (91c8499) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop   #19949      +/-   ##
===========================================
- Coverage    69.47%   69.47%   -0.01%     
===========================================
  Files          988      988              
  Lines        37313    37306       -7     
  Branches      9989     9986       -3     
===========================================
- Hits         25923    25916       -7     
  Misses       11390    11390              
Impacted Files Coverage Δ
ui/components/app/add-network/add-network.js 56.25% <ø> (ø)
...nced-gas-fee-defaults/advanced-gas-fee-defaults.js 100.00% <ø> (ø)
...ed-gas-fee-gas-limit/advanced-gas-fee-gas-limit.js 100.00% <ø> (ø)
...s/app/approve-content-card/approve-content-card.js 75.00% <ø> (ø)
ui/components/app/beta-header/index.js 100.00% <ø> (ø)
...p/cancel-speedup-popover/cancel-speedup-popover.js 78.12% <ø> (ø)
ui/components/app/confirm-data/confirm-data.js 93.75% <ø> (ø)
...m-legacy-gas-display/confirm-legacy-gas-display.js 93.55% <ø> (ø)
.../components/app/confirm-hexdata/confirm-hexdata.js 88.89% <ø> (ø)
...page-container/confirm-page-container.component.js 68.85% <ø> (ø)
... and 145 more

Copy link
Member

@FrederikBolding FrederikBolding left a comment

Choose a reason for hiding this comment

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

LGTM

Note: I only reviewed the files under snaps ownership since this PR already had multiple approvals.

@georgewrmarshall georgewrmarshall merged commit 74cc312 into develop Jul 14, 2023
9 checks passed
@georgewrmarshall georgewrmarshall deleted the fix/19569/deprecate-old-text-add-new branch July 14, 2023 17:59
@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2023
@metamaskbot metamaskbot added the release-10.34.1 Issue or pull request that will be included in release 10.34.1 label Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-10.34.1 Issue or pull request that will be included in release 10.34.1 team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Text component to use TS version of Box
6 participants