Skip to content

Remove the need for global state when expanding comments - #3795

Merged
oliverlloyd merged 1 commit into
mainfrom
oliver/don't-use-setisexpanded
Jan 6, 2022
Merged

oliverlloyd merged 1 commit into
mainfrom
oliver/don't-use-setisexpanded

Conversation

@oliverlloyd

@oliverlloyd oliverlloyd commented Jan 5, 2022 •

Copy link
Copy Markdown
Contributor

What does this change?

This PR adds @guardian/discussion-rendering@9.1.0 which will expand comments if it sees #comments in the url. This removes the need to manually call setIsExpanded and allows the CommentCount component to work in isolation.

Why?

By making CommentCount independent we can break it out into it's own Island, removing the need for global state and furthering the wider goal of deleting App.tsx

What next?

To achieve the stated aim of removing the count of comments as a piece of global state, we will also need to drop down the api call to get details for a discussion. This will result in the same api call being made twice but by using SWR we expect to prevent any increase in origin traffic

@github-actions

github-actions Bot commented Jan 5, 2022

Copy link
Copy Markdown

Size Change: +367 B (0%)

Total Size: 3.14 MB

Filename Size Change
dotcom-rendering/dist/frontend.server.js 2.44 MB +188 B (0%)
dotcom-rendering/dist/react.js 139 kB +86 B (0%)
dotcom-rendering/dist/react.legacy.js 144 kB +93 B (0%)
ℹ️ View Unchanged
Filename Size
dotcom-rendering/dist/101.js 21.1 kB
dotcom-rendering/dist/101.legacy.js 21.1 kB
dotcom-rendering/dist/195.js 1.11 kB
dotcom-rendering/dist/195.legacy.js 1.23 kB
dotcom-rendering/dist/686.js 3.64 kB
dotcom-rendering/dist/686.legacy.js 3.74 kB
dotcom-rendering/dist/688.js 13.7 kB
dotcom-rendering/dist/688.legacy.js 14.7 kB
dotcom-rendering/dist/atomIframe.js 1.87 kB
dotcom-rendering/dist/atomIframe.legacy.js 2.14 kB
dotcom-rendering/dist/bootCmp.js 7.5 kB
dotcom-rendering/dist/bootCmp.legacy.js 11.1 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/cmp.js 7.76 kB
dotcom-rendering/dist/coreVitals.js 4.03 kB
dotcom-rendering/dist/coreVitals.legacy.js 4.33 kB
dotcom-rendering/dist/dynamicImport.js 2.99 kB
dotcom-rendering/dist/dynamicImport.legacy.js 3.29 kB
dotcom-rendering/dist/EditionDropdown.js 685 B
dotcom-rendering/dist/EditionDropdown.legacy.js 694 B
dotcom-rendering/dist/elements-CalloutBlockComponent.js 4.14 kB
dotcom-rendering/dist/elements-CalloutBlockComponent.legacy.js 4.46 kB
dotcom-rendering/dist/elements-DocumentBlockComponent.js 571 B
dotcom-rendering/dist/elements-DocumentBlockComponent.legacy.js 602 B
dotcom-rendering/dist/elements-InstagramBlockComponent.js 434 B
dotcom-rendering/dist/elements-InstagramBlockComponent.legacy.js 452 B
dotcom-rendering/dist/elements-InteractiveBlockComponent.js 2.96 kB
dotcom-rendering/dist/elements-InteractiveBlockComponent.legacy.js 3.1 kB
dotcom-rendering/dist/elements-InteractiveContentsBlockComponent.js 1.88 kB
dotcom-rendering/dist/elements-InteractiveContentsBlockComponent.legacy.js 1.95 kB
dotcom-rendering/dist/elements-MapEmbedBlockComponent.js 1.88 kB
dotcom-rendering/dist/elements-MapEmbedBlockComponent.legacy.js 1.94 kB
dotcom-rendering/dist/elements-RichLinkComponent.js 3.26 kB
dotcom-rendering/dist/elements-RichLinkComponent.legacy.js 3.3 kB
dotcom-rendering/dist/elements-SpotifyBlockComponent.js 1.8 kB
dotcom-rendering/dist/elements-SpotifyBlockComponent.legacy.js 1.86 kB
dotcom-rendering/dist/elements-VideoFacebookBlockComponent.js 1.88 kB
dotcom-rendering/dist/elements-VideoFacebookBlockComponent.legacy.js 1.94 kB
dotcom-rendering/dist/elements-VineBlockComponent.js 579 B
dotcom-rendering/dist/elements-VineBlockComponent.legacy.js 594 B
dotcom-rendering/dist/elements-YoutubeBlockComponent.js 2.57 kB
dotcom-rendering/dist/elements-YoutubeBlockComponent.legacy.js 2.7 kB
dotcom-rendering/dist/embedIframe.js 1.88 kB
dotcom-rendering/dist/embedIframe.legacy.js 2.14 kB
dotcom-rendering/dist/ga.js 3.88 kB
dotcom-rendering/dist/ga.legacy.js 4.14 kB
dotcom-rendering/dist/GetMatchStats.js 3.29 kB
dotcom-rendering/dist/GetMatchStats.legacy.js 3.36 kB
dotcom-rendering/dist/guardian-braze-components-banner.js 9.78 kB
dotcom-rendering/dist/guardian-braze-components-banner.legacy.js 9.79 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.js 6.56 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.legacy.js 6.57 kB
dotcom-rendering/dist/islands.js 7.06 kB
dotcom-rendering/dist/islands.legacy.js 7.81 kB
dotcom-rendering/dist/MostViewedFooterData.js 6.27 kB
dotcom-rendering/dist/MostViewedFooterData.legacy.js 6.36 kB
dotcom-rendering/dist/MostViewedRightWrapper.js 3.89 kB
dotcom-rendering/dist/MostViewedRightWrapper.legacy.js 4.07 kB
dotcom-rendering/dist/newsletterEmbedIframe.js 1.83 kB
dotcom-rendering/dist/newsletterEmbedIframe.legacy.js 2.1 kB
dotcom-rendering/dist/OnwardsLower.js 9.63 kB
dotcom-rendering/dist/OnwardsLower.legacy.js 9.86 kB
dotcom-rendering/dist/OnwardsUpper.js 14.1 kB
dotcom-rendering/dist/OnwardsUpper.legacy.js 14.3 kB
dotcom-rendering/dist/ophan.js 7.18 kB
dotcom-rendering/dist/ophan.legacy.js 7.38 kB
dotcom-rendering/dist/relativeTime.js 2.41 kB
dotcom-rendering/dist/relativeTime.legacy.js 2.68 kB
dotcom-rendering/dist/sentry.js 677 B
dotcom-rendering/dist/sentry.legacy.js 687 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 1.82 kB
dotcom-rendering/dist/SignInGateMain.legacy.js 1.85 kB

compressed-size-action

@ioannakok ioannakok left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@oliverlloyd oliverlloyd mentioned this pull request Jan 5, 2022
@oliverlloyd
oliverlloyd merged commit 3b1fbe5 into main Jan 6, 2022
@oliverlloyd
oliverlloyd deleted the oliver/don't-use-setisexpanded branch January 6, 2022 09:54
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.

3 participants