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 commercial boot process #1764

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

emma-imber
Copy link
Contributor

@emma-imber emma-imber commented Jan 24, 2025

What does this change?

Splits out the loadModules, recordCommercialMetrics and bootCommercial functions into a separate init-utils file for tidiness. Also splits consented.ts into two files - ad-free.ts and consented-advertising.ts. This (in my opinion) makes the ad free logic easier to find and clearer to read. By doing this, we also get rid of the idea of "base" and "extra" modules, which were confusingly named.

Why?

Having explained this code several times over the last few weeks to different people, I have noticed a few parts that don't make immediate sense when you try to explain them (eg the naming of base vs extra modules). I think this little refactor is much more readable, and focuses the different bundle entry point files on the modules that they load.

Also, by having an ad-free specific file, we should be shipping less code to end users who don't see ads. I am also in favour of having the ad free check in the commercial file instead of the consented file, as I think it makes the purpose of each file much clearer to understand.

Would like to hear other people's thoughts on if this is an improvement or not!

Copy link

changeset-bot bot commented Jan 24, 2025

⚠️ No Changeset found

Latest commit: 89534d2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@emma-imber emma-imber changed the title Refactor module loading to make it easier to read Refactor commercial boot process Jan 24, 2025
Copy link
Contributor

Ad load time test results

For consented, top-above-nav took on average 4321ms to load.
For consentless, top-above-nav took on average 3077ms to load.

Test conditions:

  • 5mbps download speed
  • 1.5mbps upload speed
  • 150ms latency

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.

1 participant