Improve SSR of the Disclosure
component
#2645
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.
This PR improves the SSR of the
Disclosure
component in a Vue js application.When you don't pass in a custom ID, a fresh ID would be generated as the
default
logic for theid
prop. However, this doesn't play nicely with Vue / Nuxt SSR. Restructuring the code and updating the ID on the client if an ID is passed solves the SSR issue.We also added SSR related tests to show that SSR and Hydrating is working as expected.
This is still a WIP, because in Nuxt.js there is something happening that's a bit odd. The ID for thebutton
and thepanel
are correct, and thearia-controls
on the button points to the ID of thepanel
which is all fine.The moment it is hydrated and you look at the devtools then the IDs do not line up anymore and they are different.To make things worse, logging theID
that we are setting internally is showing the correct ID...Going to pick @thecrypticace's brain for a bit to see if we can solve this or if this is a Nuxt.js bug.This PR is already better than before, but hopefully we can solve that part as well.Fixes: #2624