Add SSR support - #70
Merged
Merged
Conversation
treycucco
reviewed
Aug 6, 2026
treycucco
left a comment
There was a problem hiding this comment.
This looks like a good change Emma. I want to have Vitor look over it since I haven't done anything in this repo. My main suggestions, listed in the comments below is this:
Don't unconditionally call set state, use the cached value being defined to bail out. Default the state to use the cached value, or fallback if necessary. And wrap all that logic (the state and the effect) into a named hook that only returns the width, so all the hooks dealing with reading and calculating the width are batched up together.
buzinas
approved these changes
Aug 8, 2026
buzinas
left a comment
Collaborator
There was a problem hiding this comment.
Overall looks good, but I'm wondering if we could avoid the effect by just letting the calculation happens as it did before.
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.
This moves the scrollbar width measurement into an effect so that it won't run during SSR.
To test this out, I linked my locally built
react-custom-scrollerto a repo that has prerendering enabled, and verified that there were no errors while running or building.