Fix SSR tab rendering on React 17 #2102
Merged
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.
We currently use unique IDs to figure out what tabs should be visible. This works fine in React 18 but not in React 17 where
useId
doesn't exist. We have our ownuseId
hook but it doesn't work with SSR because React internals don't provide necessary information across the client and server to determine a stable ID. (Technically the client can but the server cannot). The best fix for this is really to upgrade to React 18 and all these problems disappear.So we've tweaked our setup a bit to work better with React 17 SSR. The main problems here are:
I haven't mirrored any of these changes to Vue because SSR works differently there and doesn't have double rendering problems. Some of the architectural changes should be carried over though. I want to validate this approach before I do that.
Fixes #1488