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

RFC: use React Context to pass server side tests #7126

Closed
wants to merge 1 commit into from

Conversation

bryophyta
Copy link
Contributor

@bryophyta bryophyta commented Feb 3, 2023

What?

  • Add a useServerSideTests hook which wraps a React Context provider.
  • Provide a proof-of-concept for how it might be used (wrapping a page at a high level, so that the context is available to all sub-components.
  • Add a sketch of how this context could be mocked in a standardised way in Storybook.

Why?

Sometimes we need to access server-side test switches in DCR.

The options currently available:

  • Prop drilling from the top level component down to the component which needs the switch data.
  • If the component is wrapped in an <Island> then it can access the window.guardian config on the client side, which includes server-side test information.

Our component tree is very deep in some places (e.g. elements of a fronts card could easily be 10 levels down from the root component which has direct access to the switch data). This makes prop drilling more time-consuming and error-prone. Generally we have an established preference for prop drilling in DCR but for temporary tests the cost of adding and then removing multiple levels of prop drilling seems disproportionately high.

Alternatives to the status quo:

  • Singleton pattern?
  • A more radical re-think of how we implement server-side tests in DCR.
  • React Context (or some other similar 'global' store) <-- The approach explored in this RFC.

The React Context approach avoids prop drilling and uses an idiomatic React pattern to do so.

Precedents

Pitfalls

'Magic' creep

As mentioned above, the accepted pattern in DCR is to favour prop drilling in part because it's more explicit, and relies less on the kind of 'magic' which can make a codebase hard to reason about.

In this RFC I am not suggesting that we should give up this pattern in general. Using the wrapper and custom hook allows us to limit the footprint of Context to a specific use-case, and also allows the Context Provider to be read-only. In this way I don't think it sets a precedent of reaching for Context as a catch-all shortcut.

Fragments and Storybook

If we put the ServerSideTestProvider at the top level of each of the main rendering components (as I have in ArticlePage.tsx in this branch) then most components should have the context if and when they need it. But this doesn't apply to Storybook stories, or any other place where we might render components outside these main routes.

As things stand, the useServerSideTests hook will throw a runtime error if it's used outside of the ServerSideTestProvider. We could rewrite it to catch the error (or not throw it in the first place) but it's probably good to have it fail loudly.

I've added a decorator function which could be used in Storybook to mock the context provider. Because it's a decorator, it can be applied to individual stories or to whole sets of stories for a component, which should reduce boilerplate.

That said, we might still face an inverse prop-drilling issue, whereby adding a context hook to any child component requires at least one of its parent components to contain the context provider. (e.g. adding a test to cards will break all the container stories.) That would be quite annoying. One way around this might be to create a global Storybook decorator which yields 'control' for any test name that's queried. Generally speaking we'll want our storybook to reflect the 'control' versions of components anyway, and there's nothing to stop us from opting in to the 'variant' for particular stories using something like the mocking function I've sketched here.

Nevertheless, the fact that tooling doesn't seem to be able to easily identify whether the relevant context will be present feels like a bit of a negative.

Tooling

Throwing a runtime error if the hook is used outside of the Provider scope should mean that issues are caught before they're deployed. But it would be nice if it could fail earlier (i.e. by provoking linter or compiler errors). I don't know if there's a good option for doing this.

theme: ArticlePillar.News,
};

const ArticleHeadlineWithTest = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm creating this component in the story file just to demonstrate what a component with a test would look like. We can imagine that this is a regular component in the components/ directory which has had test code added to it.

commercialMetricsEnabled={
!!CAPIArticle.config.switches.commercialMetrics
}
<ServerSideTestProvider tests={CAPIArticle.config.abTests}>
Copy link
Contributor Author

@bryophyta bryophyta Feb 3, 2023

Choose a reason for hiding this comment

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

the only significant change in this file should be adding this ServerSideTestProvider wrapper (the rest is just indentation)

return context;
};

/**
Copy link
Contributor Author

@bryophyta bryophyta Feb 3, 2023

Choose a reason for hiding this comment

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

I've adapted the wrapper component and the hook code above from ContentABTest.tsx in AMP (which in turn follows the pattern recommended by Kent C. Dodds.

The Storybook decorator is something new that I've come up with today (which probably shows when you read the code!)

It feels like Storybook/Chromatic might be one of the main pain points for using Context in this way, so I thought it would be worth trying to create a user-friendly way to mock the ServerSideTestsProvider in Storybook.

Using a factory here doesn't feel ideal tbh. I ended up doing it to make the type declarations easier (for me, at least!) but I'm sure that it could be rewritten in a more user-friendly way if the pattern is adopted.

@github-actions
Copy link

github-actions bot commented Feb 3, 2023

Size Change: +193 B (0%)

Total Size: 1.97 MB

Filename Size Change
dotcom-rendering/dist/frontend.server.js 438 kB +193 B (0%)
ℹ️ View Unchanged
Filename Size
dotcom-rendering/dist/1191.variant.********************.js 3.08 kB
dotcom-rendering/dist/1325.legacy.********************.js 2.36 kB
dotcom-rendering/dist/1586.legacy.********************.js 6.06 kB
dotcom-rendering/dist/1586.modern.********************.js 5.65 kB
dotcom-rendering/dist/176.variant.********************.js 6.39 kB
dotcom-rendering/dist/1917.variant.********************.js 2.52 kB
dotcom-rendering/dist/2005.legacy.********************.js 2.98 kB
dotcom-rendering/dist/2005.modern.********************.js 2.93 kB
dotcom-rendering/dist/2136.variant.********************.js 3.11 kB
dotcom-rendering/dist/2153.variant.********************.js 1.88 kB
dotcom-rendering/dist/2239.legacy.********************.js 23.1 kB
dotcom-rendering/dist/2239.modern.********************.js 21.7 kB
dotcom-rendering/dist/2284.legacy.********************.js 21.9 kB
dotcom-rendering/dist/2310.variant.********************.js 3.36 kB
dotcom-rendering/dist/2563.legacy.********************.js 5.23 kB
dotcom-rendering/dist/2563.modern.********************.js 5.21 kB
dotcom-rendering/dist/2599.modern.********************.js 4.03 kB
dotcom-rendering/dist/2929.modern.********************.js 5.39 kB
dotcom-rendering/dist/3033.variant.********************.js 3.16 kB
dotcom-rendering/dist/3129.modern.********************.js 2.28 kB
dotcom-rendering/dist/344.variant.********************.js 11.2 kB
dotcom-rendering/dist/3467.variant.********************.js 17.6 kB
dotcom-rendering/dist/3490.modern.********************.js 21.1 kB
dotcom-rendering/dist/35.js 2.01 kB
dotcom-rendering/dist/3737.legacy.********************.js 8.36 kB
dotcom-rendering/dist/3801.modern.********************.js 6.2 kB
dotcom-rendering/dist/3981.legacy.********************.js 2.04 kB
dotcom-rendering/dist/3993.variant.********************.js 6.21 kB
dotcom-rendering/dist/4001.legacy.********************.js 2.97 kB
dotcom-rendering/dist/4001.modern.********************.js 2.93 kB
dotcom-rendering/dist/4180.variant.********************.js 5.13 kB
dotcom-rendering/dist/4331.variant.********************.js 5.25 kB
dotcom-rendering/dist/463.js 10.5 kB
dotcom-rendering/dist/4730.variant.********************.js 3.62 kB
dotcom-rendering/dist/4850.modern.********************.js 4.31 kB
dotcom-rendering/dist/490.js 2.6 kB
dotcom-rendering/dist/5002.variant.********************.js 4.25 kB
dotcom-rendering/dist/5237.variant.********************.js 2.44 kB
dotcom-rendering/dist/5371.variant.********************.js 3.78 kB
dotcom-rendering/dist/5578.legacy.********************.js 5.14 kB
dotcom-rendering/dist/5578.modern.********************.js 5.09 kB
dotcom-rendering/dist/6.js 9 kB
dotcom-rendering/dist/6297.legacy.********************.js 21.1 kB
dotcom-rendering/dist/6297.modern.********************.js 21.1 kB
dotcom-rendering/dist/6297.variant.********************.js 21.1 kB
dotcom-rendering/dist/6345.variant.********************.js 4.68 kB
dotcom-rendering/dist/6429.variant.********************.js 3.5 kB
dotcom-rendering/dist/6539.modern.********************.js 4.46 kB
dotcom-rendering/dist/7282.variant.********************.js 23.5 kB
dotcom-rendering/dist/729.legacy.********************.js 4.46 kB
dotcom-rendering/dist/729.modern.********************.js 4.32 kB
dotcom-rendering/dist/729.variant.********************.js 4.26 kB
dotcom-rendering/dist/7635.legacy.********************.js 2.58 kB
dotcom-rendering/dist/7734.legacy.********************.js 5.53 kB
dotcom-rendering/dist/7734.modern.********************.js 5.5 kB
dotcom-rendering/dist/7909.variant.********************.js 2.28 kB
dotcom-rendering/dist/7983.legacy.********************.js 3.04 kB
dotcom-rendering/dist/7983.modern.********************.js 2.96 kB
dotcom-rendering/dist/8500.legacy.********************.js 4.89 kB
dotcom-rendering/dist/8500.modern.********************.js 4.76 kB
dotcom-rendering/dist/8606.modern.********************.js 7.97 kB
dotcom-rendering/dist/8639.legacy.********************.js 3.11 kB
dotcom-rendering/dist/8639.modern.********************.js 3.04 kB
dotcom-rendering/dist/88.legacy.********************.js 3.82 kB
dotcom-rendering/dist/8809.legacy.********************.js 3.44 kB
dotcom-rendering/dist/8887.legacy.********************.js 3.2 kB
dotcom-rendering/dist/8887.modern.********************.js 3.18 kB
dotcom-rendering/dist/918.variant.********************.js 1.88 kB
dotcom-rendering/dist/9494.legacy.********************.js 5.34 kB
dotcom-rendering/dist/9494.modern.********************.js 4.14 kB
dotcom-rendering/dist/9861.variant.********************.js 3.5 kB
dotcom-rendering/dist/AlreadyVisited-importable.legacy.********************.js 410 B
dotcom-rendering/dist/AlreadyVisited-importable.modern.********************.js 411 B
dotcom-rendering/dist/AlreadyVisited-importable.variant.********************.js 411 B
dotcom-rendering/dist/atomIframe.legacy.********************.js 515 B
dotcom-rendering/dist/atomIframe.modern.********************.js 515 B
dotcom-rendering/dist/atomIframe.variant.********************.js 513 B
dotcom-rendering/dist/AudioAtomWrapper-importable.legacy.********************.js 514 B
dotcom-rendering/dist/AudioAtomWrapper-importable.modern.********************.js 458 B
dotcom-rendering/dist/AudioAtomWrapper-importable.variant.********************.js 466 B
dotcom-rendering/dist/Branding-importable.legacy.********************.js 1.95 kB
dotcom-rendering/dist/Branding-importable.modern.********************.js 1.93 kB
dotcom-rendering/dist/Branding-importable.variant.********************.js 2.18 kB
dotcom-rendering/dist/braze-web-sdk-core.legacy.********************.js 36.9 kB
dotcom-rendering/dist/braze-web-sdk-core.modern.********************.js 36.9 kB
dotcom-rendering/dist/braze-web-sdk-core.variant.********************.js 36.9 kB
dotcom-rendering/dist/BrazeMessaging-importable.legacy.********************.js 5.45 kB
dotcom-rendering/dist/BrazeMessaging-importable.modern.********************.js 4.9 kB
dotcom-rendering/dist/BrazeMessaging-importable.variant.********************.js 4.92 kB
dotcom-rendering/dist/CalloutBlockComponent-importable.legacy.********************.js 5.35 kB
dotcom-rendering/dist/CalloutBlockComponent-importable.modern.********************.js 5.06 kB
dotcom-rendering/dist/CalloutBlockComponent-importable.variant.********************.js 5.58 kB
dotcom-rendering/dist/CalloutEmbedBlockComponent-importable.legacy.********************.js 6.14 kB
dotcom-rendering/dist/CalloutEmbedBlockComponent-importable.modern.********************.js 5.74 kB
dotcom-rendering/dist/CalloutEmbedBlockComponent-importable.variant.********************.js 7.08 kB
dotcom-rendering/dist/Carousel-importable.legacy.********************.js 4.48 kB
dotcom-rendering/dist/Carousel-importable.modern.********************.js 3.36 kB
dotcom-rendering/dist/Carousel-importable.variant.********************.js 5.25 kB
dotcom-rendering/dist/ChartAtomWrapper-importable.legacy.********************.js 492 B
dotcom-rendering/dist/ChartAtomWrapper-importable.modern.********************.js 490 B
dotcom-rendering/dist/ChartAtomWrapper-importable.variant.********************.js 477 B
dotcom-rendering/dist/CommentCount-importable.legacy.********************.js 2.71 kB
dotcom-rendering/dist/CommentCount-importable.modern.********************.js 2.63 kB
dotcom-rendering/dist/CommentCount-importable.variant.********************.js 2.82 kB
dotcom-rendering/dist/debug.js 1.75 kB
dotcom-rendering/dist/discussion.legacy.********************.js 393 B
dotcom-rendering/dist/discussion.modern.********************.js 391 B
dotcom-rendering/dist/discussion.variant.********************.js 394 B
dotcom-rendering/dist/DiscussionContainer-importable.legacy.********************.js 4.02 kB
dotcom-rendering/dist/DiscussionContainer-importable.modern.********************.js 3.78 kB
dotcom-rendering/dist/DiscussionContainer-importable.variant.********************.js 4.08 kB
dotcom-rendering/dist/DiscussionMeta-importable.legacy.********************.js 3.16 kB
dotcom-rendering/dist/DiscussionMeta-importable.modern.********************.js 3.08 kB
dotcom-rendering/dist/DiscussionMeta-importable.variant.********************.js 3.34 kB
dotcom-rendering/dist/DocumentBlockComponent-importable.legacy.********************.js 2.48 kB
dotcom-rendering/dist/DocumentBlockComponent-importable.modern.********************.js 2.33 kB
dotcom-rendering/dist/DocumentBlockComponent-importable.variant.********************.js 2.72 kB
dotcom-rendering/dist/EmbedBlockComponent-importable.legacy.********************.js 2.91 kB
dotcom-rendering/dist/EmbedBlockComponent-importable.modern.********************.js 2.76 kB
dotcom-rendering/dist/EmbedBlockComponent-importable.variant.********************.js 3.25 kB
dotcom-rendering/dist/embedIframe.legacy.********************.js 522 B
dotcom-rendering/dist/embedIframe.modern.********************.js 517 B
dotcom-rendering/dist/embedIframe.variant.********************.js 518 B
dotcom-rendering/dist/EnhancePinnedPost-importable.legacy.********************.js 1.96 kB
dotcom-rendering/dist/EnhancePinnedPost-importable.modern.********************.js 1.92 kB
dotcom-rendering/dist/EnhancePinnedPost-importable.variant.********************.js 1.93 kB
dotcom-rendering/dist/FetchCommentCounts-importable.legacy.********************.js 2.91 kB
dotcom-rendering/dist/FetchCommentCounts-importable.modern.********************.js 2.85 kB
dotcom-rendering/dist/FetchCommentCounts-importable.variant.********************.js 3 kB
dotcom-rendering/dist/FetchOnwardsData-importable.legacy.********************.js 2.23 kB
dotcom-rendering/dist/FetchOnwardsData-importable.modern.********************.js 1.46 kB
dotcom-rendering/dist/FetchOnwardsData-importable.variant.********************.js 2.5 kB
dotcom-rendering/dist/FilterButton-importable.legacy.********************.js 2.17 kB
dotcom-rendering/dist/FilterButton-importable.modern.********************.js 2.1 kB
dotcom-rendering/dist/FilterButton-importable.variant.********************.js 2.55 kB
dotcom-rendering/dist/FilterKeyEventsToggle-importable.legacy.********************.js 3.01 kB
dotcom-rendering/dist/FilterKeyEventsToggle-importable.modern.********************.js 2.92 kB
dotcom-rendering/dist/FilterKeyEventsToggle-importable.variant.********************.js 3.37 kB
dotcom-rendering/dist/FocusStyles-importable.legacy.********************.js 612 B
dotcom-rendering/dist/FocusStyles-importable.modern.********************.js 550 B
dotcom-rendering/dist/FocusStyles-importable.variant.********************.js 509 B
dotcom-rendering/dist/frameworks.legacy.********************.js 20.2 kB
dotcom-rendering/dist/frameworks.modern.********************.js 20.2 kB
dotcom-rendering/dist/frameworks.variant.********************.js 20.2 kB
dotcom-rendering/dist/GetCricketScoreboard-importable.legacy.********************.js 3.27 kB
dotcom-rendering/dist/GetCricketScoreboard-importable.modern.********************.js 3.11 kB
dotcom-rendering/dist/GetCricketScoreboard-importable.variant.********************.js 3.35 kB
dotcom-rendering/dist/GetMatchNav-importable.legacy.********************.js 8.98 kB
dotcom-rendering/dist/GetMatchNav-importable.modern.********************.js 8.8 kB
dotcom-rendering/dist/GetMatchNav-importable.variant.********************.js 11.3 kB
dotcom-rendering/dist/GetMatchStats-importable.legacy.********************.js 6.31 kB
dotcom-rendering/dist/GetMatchStats-importable.modern.********************.js 5.5 kB
dotcom-rendering/dist/GetMatchStats-importable.variant.********************.js 6.29 kB
dotcom-rendering/dist/GetMatchTabs-importable.legacy.********************.js 2.32 kB
dotcom-rendering/dist/GetMatchTabs-importable.modern.********************.js 2.19 kB
dotcom-rendering/dist/GetMatchTabs-importable.variant.********************.js 2.41 kB
dotcom-rendering/dist/guardian-braze-components-banner.legacy.********************.js 11.5 kB
dotcom-rendering/dist/guardian-braze-components-banner.modern.********************.js 11.5 kB
dotcom-rendering/dist/guardian-braze-components-banner.variant.********************.js 11.8 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.legacy.********************.js 9.58 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.modern.********************.js 9.46 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.variant.********************.js 9.71 kB
dotcom-rendering/dist/GuideAtomWrapper-importable.legacy.********************.js 492 B
dotcom-rendering/dist/GuideAtomWrapper-importable.modern.********************.js 493 B
dotcom-rendering/dist/GuideAtomWrapper-importable.variant.********************.js 476 B
dotcom-rendering/dist/HeaderTopBar-importable.legacy.********************.js 9.92 kB
dotcom-rendering/dist/HeaderTopBar-importable.modern.********************.js 8.72 kB
dotcom-rendering/dist/HeaderTopBar-importable.variant.********************.js 10.8 kB
dotcom-rendering/dist/index.legacy.********************.js 36.4 kB
dotcom-rendering/dist/index.modern.********************.js 30.9 kB
dotcom-rendering/dist/index.variant.********************.js 30.9 kB
dotcom-rendering/dist/InstagramBlockComponent-importable.legacy.********************.js 2.58 kB
dotcom-rendering/dist/InstagramBlockComponent-importable.modern.********************.js 2.46 kB
dotcom-rendering/dist/InstagramBlockComponent-importable.variant.********************.js 2.78 kB
dotcom-rendering/dist/InteractiveBlockComponent-importable.legacy.********************.js 4.41 kB
dotcom-rendering/dist/InteractiveBlockComponent-importable.modern.********************.js 4.24 kB
dotcom-rendering/dist/InteractiveBlockComponent-importable.variant.********************.js 5.8 kB
dotcom-rendering/dist/InteractiveContentsBlockComponent-importable.legacy.********************.js 3.79 kB
dotcom-rendering/dist/InteractiveContentsBlockComponent-importable.modern.********************.js 3.68 kB
dotcom-rendering/dist/InteractiveContentsBlockComponent-importable.variant.********************.js 4.07 kB
dotcom-rendering/dist/KeyEventsCarousel-importable.legacy.********************.js 1.91 kB
dotcom-rendering/dist/KeyEventsCarousel-importable.modern.********************.js 4.77 kB
dotcom-rendering/dist/KeyEventsCarousel-importable.variant.********************.js 3.4 kB
dotcom-rendering/dist/KnowledgeQuizAtomWrapper-importable.legacy.********************.js 499 B
dotcom-rendering/dist/KnowledgeQuizAtomWrapper-importable.modern.********************.js 498 B
dotcom-rendering/dist/KnowledgeQuizAtomWrapper-importable.variant.********************.js 484 B
dotcom-rendering/dist/LabsHeader-importable.legacy.********************.js 5.19 kB
dotcom-rendering/dist/LabsHeader-importable.modern.********************.js 5.04 kB
dotcom-rendering/dist/LabsHeader-importable.variant.********************.js 2.64 kB
dotcom-rendering/dist/LiveBlogEpic-importable.legacy.********************.js 4.78 kB
dotcom-rendering/dist/LiveBlogEpic-importable.modern.********************.js 4.42 kB
dotcom-rendering/dist/LiveBlogEpic-importable.variant.********************.js 4.72 kB
dotcom-rendering/dist/Liveness-importable.legacy.********************.js 5.21 kB
dotcom-rendering/dist/Liveness-importable.modern.********************.js 5.02 kB
dotcom-rendering/dist/Liveness-importable.variant.********************.js 5.52 kB
dotcom-rendering/dist/MapEmbedBlockComponent-importable.legacy.********************.js 4.75 kB
dotcom-rendering/dist/MapEmbedBlockComponent-importable.modern.********************.js 4.55 kB
dotcom-rendering/dist/MapEmbedBlockComponent-importable.variant.********************.js 5.3 kB
dotcom-rendering/dist/Metrics-importable.legacy.********************.js 2.41 kB
dotcom-rendering/dist/Metrics-importable.modern.********************.js 2.15 kB
dotcom-rendering/dist/Metrics-importable.variant.********************.js 2.18 kB
dotcom-rendering/dist/MostViewedFooter-importable.legacy.********************.js 6.4 kB
dotcom-rendering/dist/MostViewedFooter-importable.modern.********************.js 3.21 kB
dotcom-rendering/dist/MostViewedFooter-importable.variant.********************.js 4.88 kB
dotcom-rendering/dist/MostViewedFooterData-importable.legacy.********************.js 8.39 kB
dotcom-rendering/dist/MostViewedFooterData-importable.modern.********************.js 1.48 kB
dotcom-rendering/dist/MostViewedFooterData-importable.variant.********************.js 7.01 kB
dotcom-rendering/dist/MostViewedRightWrapper-importable.legacy.********************.js 5.61 kB
dotcom-rendering/dist/MostViewedRightWrapper-importable.modern.********************.js 4.6 kB
dotcom-rendering/dist/MostViewedRightWrapper-importable.variant.********************.js 3.71 kB
dotcom-rendering/dist/newsletterEmbedIframe.legacy.********************.js 619 B
dotcom-rendering/dist/newsletterEmbedIframe.modern.********************.js 624 B
dotcom-rendering/dist/newsletterEmbedIframe.variant.********************.js 621 B
dotcom-rendering/dist/OnwardsUpper-importable.legacy.********************.js 7.29 kB
dotcom-rendering/dist/OnwardsUpper-importable.modern.********************.js 6.3 kB
dotcom-rendering/dist/OnwardsUpper-importable.variant.********************.js 7.99 kB
dotcom-rendering/dist/PersonalityQuizAtomWrapper-importable.legacy.********************.js 500 B
dotcom-rendering/dist/PersonalityQuizAtomWrapper-importable.modern.********************.js 499 B
dotcom-rendering/dist/PersonalityQuizAtomWrapper-importable.variant.********************.js 483 B
dotcom-rendering/dist/ProfileAtomWrapper-importable.legacy.********************.js 495 B
dotcom-rendering/dist/ProfileAtomWrapper-importable.modern.********************.js 494 B
dotcom-rendering/dist/ProfileAtomWrapper-importable.variant.********************.js 478 B
dotcom-rendering/dist/PulsingDot-importable.legacy.********************.js 726 B
dotcom-rendering/dist/PulsingDot-importable.modern.********************.js 618 B
dotcom-rendering/dist/PulsingDot-importable.variant.********************.js 748 B
dotcom-rendering/dist/QandaAtomWrapper-importable.legacy.********************.js 492 B
dotcom-rendering/dist/QandaAtomWrapper-importable.modern.********************.js 492 B
dotcom-rendering/dist/QandaAtomWrapper-importable.variant.********************.js 476 B
dotcom-rendering/dist/ReaderRevenueDev-importable.legacy.********************.js 470 B
dotcom-rendering/dist/ReaderRevenueDev-importable.modern.********************.js 457 B
dotcom-rendering/dist/ReaderRevenueDev-importable.variant.********************.js 459 B
dotcom-rendering/dist/readerRevenueDevUtils.legacy.********************.js 2.98 kB
dotcom-rendering/dist/readerRevenueDevUtils.modern.********************.js 2.66 kB
dotcom-rendering/dist/readerRevenueDevUtils.variant.********************.js 2.78 kB
dotcom-rendering/dist/ReaderRevenueLinks-importable.legacy.********************.js 4.64 kB
dotcom-rendering/dist/ReaderRevenueLinks-importable.modern.********************.js 4.35 kB
dotcom-rendering/dist/ReaderRevenueLinks-importable.variant.********************.js 5.41 kB
dotcom-rendering/dist/RecipeMultiplier-importable.legacy.********************.js 3.06 kB
dotcom-rendering/dist/RecipeMultiplier-importable.modern.********************.js 2.89 kB
dotcom-rendering/dist/RecipeMultiplier-importable.variant.********************.js 3.22 kB
dotcom-rendering/dist/relativeTime.legacy.********************.js 983 B
dotcom-rendering/dist/relativeTime.modern.********************.js 972 B
dotcom-rendering/dist/relativeTime.variant.********************.js 976 B
dotcom-rendering/dist/RichLinkComponent-importable.legacy.********************.js 5.95 kB
dotcom-rendering/dist/RichLinkComponent-importable.modern.********************.js 6.49 kB
dotcom-rendering/dist/RichLinkComponent-importable.variant.********************.js 5 kB
dotcom-rendering/dist/SecureSignupIframe-importable.legacy.********************.js 7.87 kB
dotcom-rendering/dist/SecureSignupIframe-importable.modern.********************.js 7.52 kB
dotcom-rendering/dist/SecureSignupIframe-importable.variant.********************.js 2.53 kB
dotcom-rendering/dist/sentry.legacy.********************.js 711 B
dotcom-rendering/dist/sentry.modern.********************.js 717 B
dotcom-rendering/dist/sentry.variant.********************.js 717 B
dotcom-rendering/dist/SetABTests-importable.legacy.********************.js 5.04 kB
dotcom-rendering/dist/SetABTests-importable.modern.********************.js 4.81 kB
dotcom-rendering/dist/SetABTests-importable.variant.********************.js 4.86 kB
dotcom-rendering/dist/ShareCount-importable.legacy.********************.js 2.83 kB
dotcom-rendering/dist/ShareCount-importable.modern.********************.js 2.75 kB
dotcom-rendering/dist/ShareCount-importable.variant.********************.js 2.94 kB
dotcom-rendering/dist/shimport.legacy.********************.js 2.79 kB
dotcom-rendering/dist/shimport.modern.********************.js 2.79 kB
dotcom-rendering/dist/shimport.variant.********************.js 2.78 kB
dotcom-rendering/dist/ShowHideContainers-importable.legacy.********************.js 758 B
dotcom-rendering/dist/ShowHideContainers-importable.modern.********************.js 728 B
dotcom-rendering/dist/ShowHideContainers-importable.variant.********************.js 723 B
dotcom-rendering/dist/ShowMore-importable.legacy.********************.js 5.61 kB
dotcom-rendering/dist/ShowMore-importable.modern.********************.js 3.66 kB
dotcom-rendering/dist/ShowMore-importable.variant.********************.js 6.08 kB
dotcom-rendering/dist/SignInGateMain.legacy.********************.js 3.85 kB
dotcom-rendering/dist/SignInGateMain.modern.********************.js 3.71 kB
dotcom-rendering/dist/SignInGateMain.variant.********************.js 4.54 kB
dotcom-rendering/dist/SignInGateSelector-importable.legacy.********************.js 4.92 kB
dotcom-rendering/dist/SignInGateSelector-importable.modern.********************.js 4.64 kB
dotcom-rendering/dist/SignInGateSelector-importable.variant.********************.js 4.79 kB
dotcom-rendering/dist/SlotBodyEnd-importable.legacy.********************.js 3.21 kB
dotcom-rendering/dist/SlotBodyEnd-importable.modern.********************.js 2.63 kB
dotcom-rendering/dist/SlotBodyEnd-importable.variant.********************.js 2.79 kB
dotcom-rendering/dist/Snow-importable.legacy.********************.js 3.9 kB
dotcom-rendering/dist/Snow-importable.modern.********************.js 3.77 kB
dotcom-rendering/dist/Snow-importable.variant.********************.js 4.25 kB
dotcom-rendering/dist/SpotifyBlockComponent-importable.legacy.********************.js 4.68 kB
dotcom-rendering/dist/SpotifyBlockComponent-importable.modern.********************.js 4.48 kB
dotcom-rendering/dist/SpotifyBlockComponent-importable.variant.********************.js 5.14 kB
dotcom-rendering/dist/StickyBottomBanner-importable.legacy.********************.js 6.42 kB
dotcom-rendering/dist/StickyBottomBanner-importable.modern.********************.js 5.41 kB
dotcom-rendering/dist/StickyBottomBanner-importable.variant.********************.js 5.61 kB
dotcom-rendering/dist/SubNav-importable.legacy.********************.js 2.48 kB
dotcom-rendering/dist/SubNav-importable.modern.********************.js 2.43 kB
dotcom-rendering/dist/SubNav-importable.variant.********************.js 2.79 kB
dotcom-rendering/dist/SupportTheG-importable.legacy.********************.js 4.61 kB
dotcom-rendering/dist/SupportTheG-importable.modern.********************.js 4.31 kB
dotcom-rendering/dist/SupportTheG-importable.variant.********************.js 5.37 kB
dotcom-rendering/dist/TableOfContents-importable.legacy.********************.js 2.83 kB
dotcom-rendering/dist/TableOfContents-importable.modern.********************.js 2.75 kB
dotcom-rendering/dist/TableOfContents-importable.variant.********************.js 3.06 kB
dotcom-rendering/dist/TimelineAtomWrapper-importable.legacy.********************.js 494 B
dotcom-rendering/dist/TimelineAtomWrapper-importable.modern.********************.js 495 B
dotcom-rendering/dist/TimelineAtomWrapper-importable.variant.********************.js 478 B
dotcom-rendering/dist/TopicFilterBank-importable.legacy.********************.js 3.34 kB
dotcom-rendering/dist/TopicFilterBank-importable.modern.********************.js 3.25 kB
dotcom-rendering/dist/TopicFilterBank-importable.variant.********************.js 3.74 kB
dotcom-rendering/dist/TopRightAdSlot-importable.legacy.********************.js 484 B
dotcom-rendering/dist/TopRightAdSlot-importable.modern.********************.js 477 B
dotcom-rendering/dist/TopRightAdSlot-importable.variant.********************.js 653 B
dotcom-rendering/dist/TweetBlockComponent-importable.legacy.********************.js 777 B
dotcom-rendering/dist/TweetBlockComponent-importable.modern.********************.js 781 B
dotcom-rendering/dist/TweetBlockComponent-importable.variant.********************.js 999 B
dotcom-rendering/dist/UnsafeEmbedBlockComponent-importable.legacy.********************.js 2.6 kB
dotcom-rendering/dist/UnsafeEmbedBlockComponent-importable.modern.********************.js 2.47 kB
dotcom-rendering/dist/UnsafeEmbedBlockComponent-importable.variant.********************.js 2.8 kB
dotcom-rendering/dist/VideoFacebookBlockComponent-importable.legacy.********************.js 4.76 kB
dotcom-rendering/dist/VideoFacebookBlockComponent-importable.modern.********************.js 4.57 kB
dotcom-rendering/dist/VideoFacebookBlockComponent-importable.variant.********************.js 5.31 kB
dotcom-rendering/dist/VineBlockComponent-importable.legacy.********************.js 2.35 kB
dotcom-rendering/dist/VineBlockComponent-importable.modern.********************.js 2.22 kB
dotcom-rendering/dist/VineBlockComponent-importable.variant.********************.js 2.64 kB
dotcom-rendering/dist/YoutubeBlockComponent-importable.legacy.********************.js 4.18 kB
dotcom-rendering/dist/YoutubeBlockComponent-importable.modern.********************.js 3.91 kB
dotcom-rendering/dist/YoutubeBlockComponent-importable.variant.********************.js 4.44 kB

compressed-size-action

@github-actions
Copy link

github-actions bot commented Feb 3, 2023

⚡️ Lighthouse report for the changes in this PR

Lighthouse tested 2 URLs

⚠️ Budget exceeded for 3 of 12 audits.

Report for Article

tested url https://www.theguardian.com/commentisfree/2020/feb/08/hungary-now-for-the-new-right-what-venezuela-once-was-for-the-left

Category Status Expected Actual
First Contentful Paint 1500 1256
Largest Contentful Paint 3000 1326
Time to Interactive 3500 2255
Cumulative Layout Shift ⚠️ 0.002 0.016917
Total Blocking Time ⚠️ 219 298
accessibility 0.97 0.980000

Report for Front

tested url https://www.theguardian.com/uk

Category Status Expected Actual
First Contentful Paint 1500 1400
Largest Contentful Paint 3000 1665
Time to Interactive 3500 2546
Cumulative Layout Shift ⚠️ 0.002 0.012774
Total Blocking Time 716 438
accessibility 0.97 0.980000

@bryophyta bryophyta added the RFC label Feb 6, 2023
@bryophyta bryophyta marked this pull request as ready for review February 6, 2023 11:32
@bryophyta bryophyta requested a review from a team as a code owner February 6, 2023 11:32
@bryophyta bryophyta changed the title Spike: useServerSideTests hook RFC to use React Context to pass server side tests Feb 8, 2023
@bryophyta bryophyta changed the title RFC to use React Context to pass server side tests RFC: use React Context to pass server side tests Feb 8, 2023
@github-actions
Copy link

"This PR is stale because it has been open 30 days with no activity. Unless a comment is added or the “stale” label removed, this will be closed in 3 days"

@github-actions github-actions bot added the Stale label Mar 11, 2023
@github-actions
Copy link

This PR was closed because it has been stalled for 3 days with no activity.

@github-actions github-actions bot closed this Mar 14, 2023
@bryophyta
Copy link
Contributor Author

Closing this because we don't have capacity to discuss and implement at the moment. A note for future travellers, though: as far as I'm aware this pattern should work, so next time we're looking at prop-drilling server-side test info it might be worth checking this PR out.

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.

1 participant