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

Tree shake icons #7051

Merged
merged 3 commits into from Mar 2, 2023
Merged

Tree shake icons #7051

merged 3 commits into from Mar 2, 2023

Conversation

zomars
Copy link
Member

@zomars zomars commented Feb 11, 2023

What does this PR do?

Adds tree shaking support four our UI icons. Taken from here.

https://react-icons.github.io/react-icons/

Environment: Staging(main branch) / Production

Type of change

  • Chore (refactoring code, technical debt, workflow improvements)

@vercel
Copy link

vercel bot commented Feb 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
cal ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 2, 2023 at 8:00PM (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 2, 2023 at 8:00PM (UTC)

packages/ui/components/icon/Icon.tsx Show resolved Hide resolved
@@ -23,6 +23,7 @@
"@radix-ui/react-popover": "^1.0.2",
"@radix-ui/react-portal": "^1.0.0",
"@radix-ui/react-select": "^0.1.1",
"@react-icons/all-files": "^4.1.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

Added so we can import individually after transform

@JeroenReumkens
Copy link
Contributor

Very nice @zomars!
I did test for the previous setup if unused icons where in the bundle, and that wasn’t the case anymore. So I think they where already tree shaken properly. However, I think your change is even better since now we also can’t mess up the tree shaking by accident 🔥

I’m only wondering if we still need to have the icons file in our repo, since we directly map this to npm now? Although I can imagine that typescript would get confused if we’d import from a file that doens’t exist.

Apart from that a great change! Let me know when it’s out of draft.

Copy link
Member

@PeerRich PeerRich left a comment

Choose a reason for hiding this comment

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

nice new next 13.1 feature 🥰

@@ -1,3 +1,4 @@
import { StarIcon as StarIconSolid } from "@heroicons/react/solid";
Copy link
Contributor

Choose a reason for hiding this comment

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

Here is room for improvement, though, as we're including from a specific library again beyond the abstraction. NIT as we use so little hero-icons. I think you've looked into this already and this was not possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, a good follow up would be to get rid of heroicons for good

@emrysal
Copy link
Contributor

emrysal commented Feb 13, 2023

Have had a look at the comment @JeroenReumkens left; if what he's seeing is correct and tree shaking is already happening, I would argue this PR needlessly complicates the setup.

@PeerRich
Copy link
Member

isnt this ready to merge? seems pretty good to me + approved by two people @zomars

@zomars
Copy link
Member Author

zomars commented Mar 2, 2023

Waiting on bundle analyzer to give us the final veredict

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2023

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 209.95 KB (🟢 -2.77 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!

Sixty-eight Pages Changed Size

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

Page Size (compressed) First Load % of Budget (350 KB)
/404 8.34 KB 218.29 KB 62.37% (🟡 +0.09%)
/500 5.96 KB 215.91 KB 61.69% (🟡 +0.05%)
/[user] 110.84 KB 320.79 KB 91.66% (🟡 +0.05%)
/[user]/[type] 98.57 KB 308.52 KB 88.15% (🟡 +0.16%)
/[user]/[type]/embed 98.6 KB 308.55 KB 88.16% (🟡 +0.16%)
/[user]/book 187.63 KB 397.58 KB 113.59% (🟡 +0.60%)
/[user]/embed 110.91 KB 320.86 KB 91.67% (🟡 +0.06%)
/apps 169.69 KB 379.64 KB 108.47% (🟡 +0.85%)
/apps/[slug] 193.56 KB 403.51 KB 115.29% (🟡 +0.93%)
/apps/[slug]/[...pages] 392.6 KB 602.55 KB 172.16% (🟡 +1.10%)
/apps/categories 155.02 KB 364.97 KB 104.28% (🟡 +0.79%)
/apps/categories/[category] 158.29 KB 368.24 KB 105.21% (🟡 +0.80%)
/apps/installed/[category] 196.39 KB 406.34 KB 116.10% (🟡 +0.92%)
/auth/error 19.21 KB 229.16 KB 65.47% (🟡 +0.04%)
/auth/login 195.34 KB 405.29 KB 115.80% (🟡 +0.07%)
/auth/logout 7.54 KB 217.49 KB 62.14% (🟡 +0.04%)
/auth/setup 241.89 KB 451.84 KB 129.10% (🟡 +0.22%)
/availability 158.25 KB 368.2 KB 105.20% (🟡 +0.84%)
/availability/[schedule] 269.39 KB 479.34 KB 136.95% (🟡 +0.94%)
/availability/troubleshoot 155.71 KB 365.66 KB 104.47% (🟡 +0.80%)
/booking/[uid] 129.62 KB 339.57 KB 97.02% (🟡 +0.10%)
/bookings/[status] 265.88 KB 475.83 KB 135.95% (🟡 +1.05%)
/d/[link]/[slug] 98.23 KB 308.18 KB 88.05% (🟡 +0.17%)
/d/[link]/[slug]/embed 98.26 KB 308.21 KB 88.06% (🟡 +0.16%)
/d/[link]/book 187.28 KB 397.23 KB 113.49% (🟡 +0.60%)
/event-types 241.7 KB 451.65 KB 129.04% (🟢 -30.17%)
/event-types/[type] 275.49 KB 485.44 KB 138.70% (🟢 -29.79%)
/getting-started/[[...step]] 328.49 KB 538.44 KB 153.84% (🟢 -0.02%)
/more 154.64 KB 364.59 KB 104.17% (🟡 +0.79%)
/payment/[uid] 68.51 KB 278.46 KB 79.56% (🟡 +0.05%)
/settings/admin 160.07 KB 370.02 KB 105.72% (🟡 +0.96%)
/settings/admin/apps 192.96 KB 402.91 KB 115.12% (🟡 +1.00%)
/settings/admin/apps/[category] 192.94 KB 402.89 KB 115.11% (🟡 +1.00%)
/settings/admin/impersonation 160.35 KB 370.3 KB 105.80% (🟡 +0.96%)
/settings/billing 160.27 KB 370.22 KB 105.78% (🟡 +0.95%)
/settings/developer/api-keys 189.34 KB 399.29 KB 114.08% (🟡 +0.96%)
/settings/developer/webhooks 162.68 KB 372.63 KB 106.46% (🟡 +0.97%)
/settings/developer/webhooks/[id] 191.62 KB 401.57 KB 114.73% (🟡 +0.97%)
/settings/developer/webhooks/new 191.48 KB 401.43 KB 114.69% (🟡 +0.97%)
/settings/my-account/appearance 174.12 KB 384.07 KB 109.73% (🟡 +0.99%)
/settings/my-account/calendars 192.48 KB 402.43 KB 114.98% (🟡 +0.97%)
/settings/my-account/conferencing 164.53 KB 374.48 KB 106.99% (🟡 +0.98%)
/settings/my-account/general 264.9 KB 474.85 KB 135.67% (🟡 +0.97%)
/settings/my-account/profile 436.87 KB 646.82 KB 184.81% (🟡 +0.83%)
/settings/security/impersonation 162.22 KB 372.17 KB 106.34% (🟡 +0.95%)
/settings/security/password 331.51 KB 541.46 KB 154.70% (🟡 +0.96%)
/settings/security/sso 169.9 KB 379.85 KB 108.53% (🟡 +0.91%)
/settings/security/two-factor-auth 302.71 KB 512.66 KB 146.48% (🟡 +0.80%)
/settings/teams 159.82 KB 369.77 KB 105.65% (🟡 +0.96%)
/settings/teams/[id]/appearance 174.15 KB 384.1 KB 109.74% (🟡 +0.99%)
/settings/teams/[id]/billing 160.05 KB 370 KB 105.71% (🟡 +0.96%)
/settings/teams/[id]/members 295.87 KB 505.82 KB 144.52% (🟡 +1.02%)
/settings/teams/[id]/onboard-members 73.84 KB 283.79 KB 81.08% (🟡 +0.18%)
/settings/teams/[id]/profile 272.49 KB 482.44 KB 137.84% (🟡 +1.02%)
/settings/teams/[id]/sso 170 KB 379.95 KB 108.56% (🟡 +0.91%)
/settings/teams/new 113.06 KB 323.01 KB 92.29% (🟡 +0.28%)
/signup 25.2 KB 235.15 KB 67.18% (+/- <0.01%)
/team/[slug] 113.58 KB 323.53 KB 92.44% (🟡 +0.15%)
/team/[slug]/[type] 98.23 KB 308.18 KB 88.05% (🟡 +0.17%)
/team/[slug]/[type]/embed 98.26 KB 308.21 KB 88.06% (🟡 +0.16%)
/team/[slug]/book 187.28 KB 397.23 KB 113.49% (🟡 +0.60%)
/team/[slug]/embed 113.64 KB 323.59 KB 92.46% (🟡 +0.15%)
/teams 154.86 KB 364.81 KB 104.23% (🟡 +0.84%)
/video/meeting-ended/[uid] 22.75 KB 232.7 KB 66.48% (🟡 +0.09%)
/video/meeting-not-started/[uid] 22.79 KB 232.74 KB 66.50% (🟡 +0.08%)
/video/no-meeting-found 6.96 KB 216.91 KB 61.97% (🟡 +0.06%)
/workflows 167.75 KB 377.7 KB 107.92% (🟡 +0.91%)
/workflows/[workflow] 295.72 KB 505.67 KB 144.48% (🟡 +0.86%)
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

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your 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. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@zomars zomars marked this pull request as ready for review March 2, 2023 20:13
@zomars zomars requested review from a team March 2, 2023 20:13
@zomars
Copy link
Member Author

zomars commented Mar 2, 2023

I'll take this as a win

image

image

@deploysentinel
Copy link

deploysentinel bot commented Mar 2, 2023

Current Playwright Test Results Summary

✅ 53 Passing - ❌ 1 Failing

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 03/02/2023 08:15:55pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 6e0377c

Started: 03/02/2023 08:11:18pm UTC

❌ Failures

📄   apps/web/playwright/event-types.e2e.ts • 1 Failure

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Event Types tests user can add multiple organizer address
Initial Attempt
Error: Test timeout of 60000ms exceeded.
Test timeout of 60000ms exceeded.
60% (3) 3 / 5 runs
failed over last 7 days
0% (0) 0 / 5 runs
flaked over last 7 days

View Detailed Build Results


@zomars zomars merged commit 6e93224 into main Mar 2, 2023
@zomars zomars deleted the tree-shake-icons branch March 2, 2023 20:56
dmkav pushed a commit to join-com/cal-com that referenced this pull request Mar 6, 2023
* Attempt to tree shake icons

* Tree shaking icons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants