Repository navigation
Remove the need for global state when expanding comments - #3795
Merged
Merged
Conversation
oliverlloyd
requested review from
DavidLawes,
OllysCoding,
jlieb10 and
lucymonie
as code owners
January 5, 2022 12:33
|
Size Change: +367 B (0%) Total Size: 3.14 MB
ℹ️ View Unchanged
|
OllysCoding
approved these changes
Jan 5, 2022
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
This PR adds
@guardian/discussion-rendering@9.1.0which will expand comments if it sees#commentsin the url. This removes the need to manually callsetIsExpandedand allows theCommentCountcomponent to work in isolation.Why?
By making
CommentCountindependent we can break it out into it's own Island, removing the need for global state and furthering the wider goal of deleting App.tsxWhat 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