Skip to content
Discussion options

You must be logged in to vote

HashSet, like HashMap, has a randomized/arbitrary iteration order (see docs) Pretty much any time you have a hydration issue with HashMap/HashSet, this is why: the items are being iterated over in a different order on the server from the order in the client.

Depending on the particular implementation, attributes and text nodes may be set to the current (browser) version during hydration, or they may assume that the rendered (server) version is correct and move on. Even if the behavior was consistent here it would be very confusing when you made a change on the client because the client state would be inconsistent with what had been rendered on the server. (I just ran into a bug like this …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by povilasb
Comment options

You must be logged in to vote
1 reply
@gbj
Comment options

gbj Jul 20, 2025
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants