Skip to content

ArticleCount - #4250

Merged
oliverlloyd merged 42 commits into
mainfrom
oliver/article-cout
Mar 15, 2022
Merged

oliverlloyd merged 42 commits into
mainfrom
oliver/article-cout

Conversation

@oliverlloyd

@oliverlloyd oliverlloyd commented Mar 14, 2022 •

Copy link
Copy Markdown
Contributor

This PR depends on #4126

What does this change?

Moves the code to increment the article count out of App.tsx

Why?

We're deleting it

Another micro island?

Perhaps we can optimise things by not having so many micro islands making http calls from Page. This PR expands on this pattern for simplicity but I think we should look at rationalising all of these in a follow up PR.

AshCorr and others added 30 commits February 28, 2022 15:33
Migrate braze components from App.tsx to Islands.
Integrate into the layouts, and remove Portal with id `bottom-banner`.

Co-Authored-By: Olly Namey <9575458+OllysCoding@users.noreply.github.com>
SlotBodyEnd and StickyBottomBanner require an ABProvider
So their export is now a wrapper for this provider.

Co-authored-by: Olly <OllysCoding@users.noreply.github.com>
(STOP: try to refactor before using this method)

In order to avoid refactoring the existing braze logic,
we introduce a hook that returns a promise. Using
SWR with an immutable config ensures that the braze
code is run only once.
This ensures the braze code always runs at least once
on each page.

>  The reason that distinction is important is because
> even if the slots/islands don't exist on the page,
> we still want to call buildBrazeMessage currently
> as it does work to clear up after the SDK if the user
> has logged out or removed permissions for Braze to load.

#4126 (comment)
We found that for components which consume useBraze, every render was
getting a new promise from useBraze, only one of which was ever
resolving. This was causing Braze messages to not be rendered correctly.
We've simplified useBraze to return either a BrazeMessageInterface or
nothing, instead of a Promise, which has fixed the issue.

Co-authored-by: Oliver Lloyd <oliverlloyd@users.noreply.github.com>
@github-actions

github-actions Bot commented Mar 14, 2022 •

Copy link
Copy Markdown

Size Change: +197 B (0%)

Total Size: 1.52 MB

Filename Size Change
dotcom-rendering/dist/9512.js 10.2 kB +18 B (0%)
dotcom-rendering/dist/9512.legacy.js 12.1 kB +16 B (0%)
dotcom-rendering/dist/frontend.server.js 401 kB +222 B (0%)
dotcom-rendering/dist/initDiscussion.js 8.37 kB +18 B (0%)
dotcom-rendering/dist/initDiscussion.legacy.js 8.64 kB +19 B (0%)
dotcom-rendering/dist/islands.js 8.53 kB +19 B (0%)
dotcom-rendering/dist/islands.legacy.js 9.28 kB +18 B (0%)
dotcom-rendering/dist/react.js 21.2 kB -84 B (0%)
dotcom-rendering/dist/react.legacy.js 21.8 kB -79 B (0%)
dotcom-rendering/dist/readerRevenueDevUtils.js 3.2 kB +14 B (0%)
dotcom-rendering/dist/readerRevenueDevUtils.legacy.js 4.08 kB +16 B (0%)
ℹ️ View Unchanged
Filename Size
dotcom-rendering/dist/1065.legacy.js 7.49 kB
dotcom-rendering/dist/1214.js 3.15 kB
dotcom-rendering/dist/1214.legacy.js 3.21 kB
dotcom-rendering/dist/1376.js 1.65 kB
dotcom-rendering/dist/1376.legacy.js 1.75 kB
dotcom-rendering/dist/1451.js 19.1 kB
dotcom-rendering/dist/1451.legacy.js 19.8 kB
dotcom-rendering/dist/1576.legacy.js 3.2 kB
dotcom-rendering/dist/1578.js 2.41 kB
dotcom-rendering/dist/1578.legacy.js 2.43 kB
dotcom-rendering/dist/1828.js 4.54 kB
dotcom-rendering/dist/1828.legacy.js 4.54 kB
dotcom-rendering/dist/1924.js 6.08 kB
dotcom-rendering/dist/1924.legacy.js 6.45 kB
dotcom-rendering/dist/1956.js 4.13 kB
dotcom-rendering/dist/2.js 4.87 kB
dotcom-rendering/dist/2.legacy.js 4.98 kB
dotcom-rendering/dist/2058.js 8.94 kB
dotcom-rendering/dist/2058.legacy.js 9.21 kB
dotcom-rendering/dist/2299.js 3.51 kB
dotcom-rendering/dist/2299.legacy.js 3.59 kB
dotcom-rendering/dist/23.js 5.84 kB
dotcom-rendering/dist/23.legacy.js 6.13 kB
dotcom-rendering/dist/2550.legacy.js 4.35 kB
dotcom-rendering/dist/2737.js 6.16 kB
dotcom-rendering/dist/2737.legacy.js 6.51 kB
dotcom-rendering/dist/2879.js 6.97 kB
dotcom-rendering/dist/288.js 2.7 kB
dotcom-rendering/dist/2947.js 2.58 kB
dotcom-rendering/dist/2947.legacy.js 2.66 kB
dotcom-rendering/dist/2949.js 5.66 kB
dotcom-rendering/dist/2949.legacy.js 5.86 kB
dotcom-rendering/dist/2981.legacy.js 4.73 kB
dotcom-rendering/dist/3213.js 14.2 kB
dotcom-rendering/dist/3213.legacy.js 14.5 kB
dotcom-rendering/dist/3215.js 6.11 kB
dotcom-rendering/dist/3215.legacy.js 6.26 kB
dotcom-rendering/dist/3270.js 7.64 kB
dotcom-rendering/dist/3270.legacy.js 7.83 kB
dotcom-rendering/dist/3397.js 241 B
dotcom-rendering/dist/3397.legacy.js 252 B
dotcom-rendering/dist/3622.js 4.99 kB
dotcom-rendering/dist/3730.js 4.99 kB
dotcom-rendering/dist/3730.legacy.js 5.39 kB
dotcom-rendering/dist/4025.js 2.02 kB
dotcom-rendering/dist/4109.legacy.js 2.91 kB
dotcom-rendering/dist/4204.legacy.js 2.35 kB
dotcom-rendering/dist/4211.js 1.65 kB
dotcom-rendering/dist/4211.legacy.js 1.74 kB
dotcom-rendering/dist/4576.js 236 B
dotcom-rendering/dist/4576.legacy.js 247 B
dotcom-rendering/dist/4850.js 235 B
dotcom-rendering/dist/4850.legacy.js 246 B
dotcom-rendering/dist/4977.legacy.js 3.15 kB
dotcom-rendering/dist/5096.js 4.73 kB
dotcom-rendering/dist/5096.legacy.js 4.79 kB
dotcom-rendering/dist/5217.js 233 B
dotcom-rendering/dist/5217.legacy.js 245 B
dotcom-rendering/dist/5226.js 5.5 kB
dotcom-rendering/dist/5226.legacy.js 5.91 kB
dotcom-rendering/dist/5294.js 4.42 kB
dotcom-rendering/dist/5294.legacy.js 4.49 kB
dotcom-rendering/dist/53.js 4.12 kB
dotcom-rendering/dist/53.legacy.js 4.12 kB
dotcom-rendering/dist/5356.js 33.5 kB
dotcom-rendering/dist/5356.legacy.js 31.4 kB
dotcom-rendering/dist/5585.js 6.35 kB
dotcom-rendering/dist/5585.legacy.js 6.61 kB
dotcom-rendering/dist/5690.js 6.23 kB
dotcom-rendering/dist/5690.legacy.js 6.4 kB
dotcom-rendering/dist/6004.legacy.js 3.68 kB
dotcom-rendering/dist/6021.js 3.95 kB
dotcom-rendering/dist/6021.legacy.js 4.19 kB
dotcom-rendering/dist/6045.js 3.6 kB
dotcom-rendering/dist/6292.legacy.js 4.78 kB
dotcom-rendering/dist/6348.js 5.84 kB
dotcom-rendering/dist/6348.legacy.js 6.03 kB
dotcom-rendering/dist/6398.js 3.07 kB
dotcom-rendering/dist/6400.js 21.5 kB
dotcom-rendering/dist/6400.legacy.js 21.5 kB
dotcom-rendering/dist/6684.js 241 B
dotcom-rendering/dist/6684.legacy.js 253 B
dotcom-rendering/dist/6892.js 5.39 kB
dotcom-rendering/dist/6892.legacy.js 5.81 kB
dotcom-rendering/dist/6965.js 3.66 kB
dotcom-rendering/dist/6965.legacy.js 3.72 kB
dotcom-rendering/dist/6992.js 1.67 kB
dotcom-rendering/dist/6992.legacy.js 1.76 kB
dotcom-rendering/dist/7051.js 8.29 kB
dotcom-rendering/dist/7051.legacy.js 8.49 kB
dotcom-rendering/dist/7057.js 4.48 kB
dotcom-rendering/dist/7318.js 3.83 kB
dotcom-rendering/dist/7318.legacy.js 3.93 kB
dotcom-rendering/dist/7388.legacy.js 2.64 kB
dotcom-rendering/dist/750.js 5.47 kB
dotcom-rendering/dist/750.legacy.js 5.62 kB
dotcom-rendering/dist/7576.js 4.21 kB
dotcom-rendering/dist/7576.legacy.js 4.38 kB
dotcom-rendering/dist/7583.js 6.56 kB
dotcom-rendering/dist/7583.legacy.js 6.73 kB
dotcom-rendering/dist/7749.js 4.43 kB
dotcom-rendering/dist/7793.js 6.54 kB
dotcom-rendering/dist/7793.legacy.js 6.81 kB
dotcom-rendering/dist/7800.js 11.9 kB
dotcom-rendering/dist/7809.legacy.js 2.69 kB
dotcom-rendering/dist/7826.legacy.js 4.82 kB
dotcom-rendering/dist/7916.js 9.63 kB
dotcom-rendering/dist/7992.js 4.66 kB
dotcom-rendering/dist/8080.js 1.46 kB
dotcom-rendering/dist/8080.legacy.js 1.54 kB
dotcom-rendering/dist/8129.legacy.js 12.4 kB
dotcom-rendering/dist/8184.js 12 kB
dotcom-rendering/dist/8184.legacy.js 13.3 kB
dotcom-rendering/dist/824.js 426 B
dotcom-rendering/dist/824.legacy.js 483 B
dotcom-rendering/dist/8282.js 3.65 kB
dotcom-rendering/dist/8282.legacy.js 3.75 kB
dotcom-rendering/dist/8294.js 233 B
dotcom-rendering/dist/8294.legacy.js 244 B
dotcom-rendering/dist/8344.js 6.92 kB
dotcom-rendering/dist/8344.legacy.js 7.27 kB
dotcom-rendering/dist/8583.js 16.8 kB
dotcom-rendering/dist/8583.legacy.js 17.4 kB
dotcom-rendering/dist/8748.js 232 B
dotcom-rendering/dist/8748.legacy.js 243 B
dotcom-rendering/dist/8785.legacy.js 10.4 kB
dotcom-rendering/dist/8839.js 1.63 kB
dotcom-rendering/dist/8839.legacy.js 1.73 kB
dotcom-rendering/dist/9007.js 4.7 kB
dotcom-rendering/dist/9007.legacy.js 4.76 kB
dotcom-rendering/dist/9177.js 4.61 kB
dotcom-rendering/dist/9177.legacy.js 4.63 kB
dotcom-rendering/dist/9327.js 1.51 kB
dotcom-rendering/dist/9327.legacy.js 1.58 kB
dotcom-rendering/dist/9641.js 6.33 kB
dotcom-rendering/dist/9641.legacy.js 6.6 kB
dotcom-rendering/dist/9776.js 6.25 kB
dotcom-rendering/dist/9776.legacy.js 6.52 kB
dotcom-rendering/dist/9817.js 11.8 kB
dotcom-rendering/dist/9817.legacy.js 12.1 kB
dotcom-rendering/dist/atomIframe.js 1.75 kB
dotcom-rendering/dist/atomIframe.legacy.js 2.02 kB
dotcom-rendering/dist/bootCmp.js 7.76 kB
dotcom-rendering/dist/bootCmp.legacy.js 11.3 kB
dotcom-rendering/dist/braze-web-sdk-core.js 36.1 kB
dotcom-rendering/dist/braze-web-sdk-core.legacy.js 36.1 kB
dotcom-rendering/dist/coreVitals.js 3.91 kB
dotcom-rendering/dist/coreVitals.legacy.js 4.21 kB
dotcom-rendering/dist/dynamicImport.js 2.87 kB
dotcom-rendering/dist/dynamicImport.legacy.js 3.16 kB
dotcom-rendering/dist/embedIframe.js 1.75 kB
dotcom-rendering/dist/embedIframe.legacy.js 2.03 kB
dotcom-rendering/dist/ga.js 3.75 kB
dotcom-rendering/dist/ga.legacy.js 4.02 kB
dotcom-rendering/dist/guardian-braze-components-banner.js 13 kB
dotcom-rendering/dist/guardian-braze-components-banner.legacy.js 13.1 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.js 9.33 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.legacy.js 9.39 kB
dotcom-rendering/dist/newsletterEmbedIframe.js 1.91 kB
dotcom-rendering/dist/newsletterEmbedIframe.legacy.js 2.17 kB
dotcom-rendering/dist/ophan.js 7.05 kB
dotcom-rendering/dist/ophan.legacy.js 7.27 kB
dotcom-rendering/dist/relativeTime.js 2.29 kB
dotcom-rendering/dist/relativeTime.legacy.js 2.57 kB
dotcom-rendering/dist/sentry.js 715 B
dotcom-rendering/dist/sentry.legacy.js 727 B
dotcom-rendering/dist/sentryLoader.js 4.74 kB
dotcom-rendering/dist/sentryLoader.legacy.js 7.71 kB
dotcom-rendering/dist/shimport.js 2.75 kB
dotcom-rendering/dist/shimport.legacy.js 2.76 kB
dotcom-rendering/dist/SignInGateMain.js 2.98 kB
dotcom-rendering/dist/SignInGateMain.legacy.js 3.05 kB

compressed-size-action

@oliverlloyd
oliverlloyd marked this pull request as ready for review March 15, 2022 11:46

@AshCorr AshCorr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Worth just making App.tsx an island and importing that?

@oliverlloyd
oliverlloyd merged commit 90b245a into main Mar 15, 2022
@oliverlloyd
oliverlloyd deleted the oliver/article-cout branch March 15, 2022 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants