Error: Hydration Mismatch
Hello,
I have an error with one of my plugin. I have always an issue with Hydration MisMatch. Can some one help me please ?
https://github.com/qlaffont/rosetty-solid/blob/master/src/index.tsx
GitHub
rosetty-solid/src/index.tsx at master Ā· qlaffont/rosetty-solid
Complete Intl/I18n solution for Solid . Contribute to qlaffont/rosetty-solid development by creating an account on GitHub.
28 Replies
@core-team do you have any idea ?
Yes no problem
GitHub
GitHub - qlaffont/solid-start-issue-rosetty
Contribute to qlaffont/solid-start-issue-rosetty development by creating an account on GitHub.
not at all
I have try this morning
euh
Strange I have updated the package.json
and for me is not working
I push the update on the repo
So @Toka what did you do to fix it 0-o
x)
thanks for your help !
yes same issue with my other discord issue
there is an issue with SSR and i have visibly no answer or clue to fix it
ping core member dit nothing :/
and open github issue neither ...
not at all in fact :/
@core-team can we have you help on this issue :/ ?
Hi @Mirardes. Very sorry that core members haven't gotten back to you. We try to support questions like this as often as we can but everyone's stretched very thin rn. Let me ask around and see if we can get someone's time to help.
thank you ! Two of my issues are critical because actually i'm making a transition in my company to use SolidJS and i want to understand the issue to fix it and help others in my company
Absolutely, we're here to help smoothen that effort...just bear with us. There's a LOT happening atm
@lxsmnsyc š¤ sorry to ping you but do you happen to have a few minutes for our community member?
Thank you !
And I know that you guys are making a lot of thing between solid, solid primitives and solid start ! I just want to applause you for all your works !
the other issue is here if needed : https://discord.com/channels/722131463138705510/1171032087864803348
Probably the closest would be to know the hydration key that was shown in the logs then map it to the closest element in the Elements panel with the data-hk attribute
I have make a reproduction for all issues i have open if needed
reproduction ā¬ļø
It's most likely the locale. it's probably picking up differently from the default locale. I can be wrong. I'm not sure what's the implementation of rosetty
The cause would be in the following steps:
- page renders on the server with the fr locale
- page is sent on the client
- client starts hydrating
- client doesn't pick up from the default locale during hydration, instead, it renders with the locale detected from the user
This line: https://github.com/qlaffont/rosetty-solid/blob/master/src/index.tsx#L22
although still, since I'm not sure the entire implementation I can't say if there's any behavior for
rosetty
that differs between the server and clientPS. thanks Alexis. You da best
In fact it is the same local actually
I was thinking of that but if you check the reproduction you will see that we use only one language
I'll try running the repro on my laptop tomorrow. I currently have it turned off and it's a bit late for me
did you have any time to work on it ? š
haven't yet, will pick it up later
okay I've just tested it out (sorry for the delay)
I've tried removing the
usei18n
on the Main page
and it still seems to be causing issues.So I tried commenting out the
RosettyProvider
, and the hydration error was gone. So I had to go through your package rosetty-solid
to check some leads, and I think one of the main issues is this:
https://github.com/qlaffont/rosetty-solid/blob/764b75e2af878748413d696c053642265ff2188e/package.json#L106C6-L109
SolidJS is marked as a dependency
, which most likely leads to package duplicates (a common mistake in library authors). I tested this by adding a createUniqueId
call to the RosettyProvider (through the build output) and displayed thiswhich kinda proves my statement
I'd like to recommend marking SolidJS as a
peerDependency
in rosetty-solid
bonus: I'd also not recommend TSDX (not just in SolidJS, but in general). The tool has been abandoned for many years and has a lot of broken stuff in it. I'd recommend tsup as an alternative, we also have a preset for it:
https://github.com/solidjs-community/tsup-preset-solid
GitHub
GitHub - solidjs-community/tsup-preset-solid: Preset for building y...
Preset for building your SolidJS packages with tsup. - GitHub - solidjs-community/tsup-preset-solid: Preset for building your SolidJS packages with tsup.
Okay thanks you ! I will check that tomorrow and i will keep you in touch !
@lxsmnsyc š¤ do you think you have a time for another hydration issue ? It's a complete different case and i have no clue too : https://discord.com/channels/722131463138705510/1171032087864803348
@lxsmnsyc š¤ Thanks it works I close the post and I keep the other post !
Finally I'm not closing it @lxsmnsyc š¤ it seems that useContext failed on server and not in client.
I have an error with no value in context + hydration issue
As you can see the translation is set so it's very weird
seems to be an error in both?
It's very strange I don't understand it because he render the translation so it's seems to be fill
I'll get back to you later, I'm currently not with my laptop
Yes no problem thanks for your help !
any update ?
š
not yet. haven't tried anything since I got to fix some other issue.
I would assume this is still the same repo we are talking about?
yes exactly
@Mirardes is this the solid-start-cmp repo?