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

Fix intl errors in browser console #595

Merged
merged 7 commits into from
Dec 5, 2024
Merged

Fix intl errors in browser console #595

merged 7 commits into from
Dec 5, 2024

Conversation

narthur
Copy link
Collaborator

@narthur narthur commented Nov 26, 2024

This PR fixes the intl error messages that were introduced by our work on AV-78.

  • Adds a new hook useIntlMessages which handles providing intl messages and associated asynchronous loading of language files
  • Removes existing getIntlMessages custom mock
  • Adds basic getIntlMessages mocking to our global test setup
  • Converts higher-order components to standard React template components in order to avoid error messages around proper hook usage
  • Updates pages to use new template components instead of old HOCs
  • Updates a few tests to be more resilient to asynchronous rendering
  • Updates our audit configuration to skip auditing dev dependencies to reduce the number of false positives

This PR results in an increase to the global bundle size due to useIntlMessages statically importing our compiled English translations to provide on first render. All languages other than English are dynamically imported so to not be included in the global bundle.

@narthur narthur requested a review from alangumer as a code owner November 26, 2024 16:07
Copy link

vercel bot commented Nov 26, 2024

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

Name Status Preview Comments Updated (UTC)
audioverse-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2024 5:29pm

@narthur narthur self-assigned this Nov 26, 2024
Copy link

github-actions bot commented Nov 26, 2024

Localization Summary

language unchanged added removed untranslated
br 875 0 0 79
de 875 0 0 412
en 875 0 0 0
es 875 0 0 403
fr 875 0 0 420
ja 875 0 0 383
ru 875 0 0 393
zh 875 0 0 382

View full summary

Copy link

github-actions bot commented Nov 26, 2024

📦 Next.js Bundle Analysis for audioverse-next

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

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 259.14 KB (🔴 +17.08 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-one 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 (225 KB)
/[language] 10.58 KB 269.72 KB 119.88% (🟡 +0.01%)
/[language]/about/[id]/[[...slugs]] 1.88 KB 261.02 KB 116.01% (+/- <0.01%)
/[language]/account 21.77 KB 280.91 KB 124.85% (🟢 -0.01%)
/[language]/account/login 17.58 KB 276.72 KB 122.99% (🟢 -0.01%)
/[language]/account/register 18.37 KB 277.51 KB 123.34% (🟢 -0.01%)
/[language]/bibles 3.23 KB 262.37 KB 116.61% (+/- <0.01%)
/[language]/bibles/[id]/[[...slugs]] 3.12 KB 262.26 KB 116.56% (+/- <0.01%)
/[language]/bibles/[id]/[book]/[chapter] 14.83 KB 273.97 KB 121.76% (🟡 +0.01%)
/[language]/blog/[id]/[[...slugs]] 3.75 KB 262.89 KB 116.84% (+/- <0.01%)
/[language]/blog/page/[i] 3.83 KB 262.98 KB 116.88% (+/- <0.01%)
/[language]/books/[id]/[[...slugs]] 5.39 KB 264.53 KB 117.57% (🟡 +0.02%)
/[language]/books/[id]/feed.xml 654 B 259.78 KB 115.46% (🟡 +0.01%)
/[language]/books/page/[i] 2.96 KB 262.1 KB 116.49% (+/- <0.01%)
/[language]/books/tracks/[id]/[[...slugs]] 20.58 KB 279.72 KB 124.32% (+/- <0.01%)
/[language]/conferences/[id]/[[...slug]] 7.8 KB 266.95 KB 118.64% (🟡 +0.01%)
/[language]/conferences/[id]/presenters/[presenterId] 4.47 KB 263.61 KB 117.16% (+/- <0.01%)
/[language]/conferences/[id]/presenters/page/[i] 3.33 KB 262.48 KB 116.66% (+/- <0.01%)
/[language]/conferences/[id]/sequences/page/[i] 3.3 KB 262.45 KB 116.64% (🟡 +0.01%)
/[language]/conferences/[id]/teachings/page/[i] 3.31 KB 262.45 KB 116.64% (🟡 +0.01%)
/[language]/conferences/page/[i] 2.96 KB 262.11 KB 116.49% (🟡 +0.01%)
/[language]/egwbooks/page/[i] 2.97 KB 262.11 KB 116.49% (🟡 +0.01%)
/[language]/embed/media/[id] 12.66 KB 271.81 KB 120.80% (🟡 +0.01%)
/[language]/library 22.49 KB 281.63 KB 125.17% (+/- <0.01%)
/[language]/library/history 23.57 KB 282.71 KB 125.65% (+/- <0.01%)
/[language]/library/playlists 23.6 KB 282.74 KB 125.66% (🟡 +0.01%)
/[language]/library/playlists/[playlist] 5.62 KB 264.77 KB 117.67% (+/- <0.01%)
/[language]/library/playlists/[playlist]/items/[id]/[[...slugs]] 20.8 KB 279.95 KB 124.42% (+/- <0.01%)
/[language]/page/[id]/[[...slugs]] 1.44 KB 260.58 KB 115.81% (🟡 +0.01%)
/[language]/playlists/[playlist] 5.11 KB 264.25 KB 117.44% (+/- <0.01%)
/[language]/playlists/[playlist]/items/[id]/[[...slugs]] 20.8 KB 279.94 KB 124.42% (+/- <0.01%)
/[language]/presenters/[id]/[[...slug]] 5 KB 264.14 KB 117.39% (🟡 +0.01%)
/[language]/presenters/[id]/appears/page/[i] 3.42 KB 262.57 KB 116.70% (+/- <0.01%)
/[language]/presenters/[id]/sequences/page/[i] 3.42 KB 262.56 KB 116.69% (🟡 +0.01%)
/[language]/presenters/[id]/teachings/page/[i] 3.53 KB 262.67 KB 116.74% (🟡 +0.01%)
/[language]/presenters/[id]/top 1.95 KB 261.09 KB 116.04% (+/- <0.01%)
/[language]/releases/[id] 2.72 KB 261.86 KB 116.38% (🟡 +0.01%)
/[language]/search/collections/page/[i] 3.01 KB 262.16 KB 116.51% (🟡 +0.01%)
/[language]/search/persons/page/[i] 3.02 KB 262.16 KB 116.51% (🟡 +0.01%)
/[language]/search/sequences/page/[i] 3.01 KB 262.15 KB 116.51% (🟡 +0.01%)
/[language]/search/sponsors/page/[i] 3.01 KB 262.15 KB 116.51% (🟡 +0.01%)
/[language]/search/teachings/page/[i] 3 KB 262.14 KB 116.51% (+/- <0.01%)
/[language]/series/[id]/[[...slug]] 5.41 KB 264.55 KB 117.58% (🟡 +0.01%)
/[language]/series/page/[i] 2.96 KB 262.1 KB 116.49% (+/- <0.01%)
/[language]/songs/[id]/[[...slugs]] 20.57 KB 279.71 KB 124.32% (🟢 -0.01%)
/[language]/songs/albums/[id]/[[...slugs]] 5.41 KB 264.55 KB 117.58% (🟡 +0.02%)
/[language]/songs/book/[book] 6.37 KB 265.51 KB 118.01% (+/- <0.01%)
/[language]/songs/book/[book]/[id]/[[...slugs]] 20.74 KB 279.89 KB 124.39% (🟡 +0.01%)
/[language]/sponsors/[id]/[[...slugs]] 4.82 KB 263.96 KB 117.31% (🟡 +0.01%)
/[language]/sponsors/[id]/conferences/page/[i] 3.5 KB 262.65 KB 116.73% (🟡 +0.01%)
/[language]/sponsors/[id]/series/page/[i] 3.5 KB 262.64 KB 116.73% (🟡 +0.01%)
/[language]/sponsors/[id]/teachings/page/[i] 3.62 KB 262.76 KB 116.78% (+/- <0.01%)
/[language]/stories/[id]/[[...slugs]] 20.58 KB 279.72 KB 124.32% (+/- <0.01%)
/[language]/stories/albums/[id]/[[...slugs]] 5.4 KB 264.54 KB 117.58% (🟡 +0.01%)
/[language]/teachings/[id]/[[...slug]] 20.57 KB 279.72 KB 124.32% (+/- <0.01%)
/[language]/teachings/all/page/[i] 3.82 KB 262.96 KB 116.87% (+/- <0.01%)
/[language]/teachings/audio/page/[i] 3.82 KB 262.96 KB 116.87% (+/- <0.01%)
/[language]/teachings/trending/all 3.03 KB 262.17 KB 116.52% (🟡 +0.02%)
/[language]/teachings/trending/audio 2.46 KB 261.61 KB 116.27% (+/- <0.01%)
/[language]/teachings/trending/video 2.46 KB 261.6 KB 116.27% (+/- <0.01%)
/[language]/teachings/video/page/[i] 3.82 KB 262.96 KB 116.87% (+/- <0.01%)
/[language]/topics/[id]/[[...slugs]] 4.8 KB 263.94 KB 117.31% (+/- <0.01%)
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 5% 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.

Copy link

github-actions bot commented Nov 26, 2024

Accessibility Issues

CodeNewFixedRetainedIgnoredTotal
WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail00024482448
WCAG2AA.Principle2.Guideline2_4.2_4_1.H64.1000269269
View full summary

@narthur narthur merged commit cffbed5 into master Dec 5, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants