-
-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server side rendering checksum error #56
Comments
This is the method causing an error when using serverside rendering the ID will always differ client and serverside: // Get a universally unique identifier
let count = 0;
module.exports = function uuid() {
return 'react-tabs-' + count++;
}; |
And the adding of tabs whether or not they have been added: // Add ids if new tabs have been added
// Don't bother removing ids, just keep them in case they are added again
// This is more efficient, and keeps the uuid counter under control
while (diff++ < 0) {
tabIds.push(uuid());
panelIds.push(uuid());
} |
Running into the same problem here. Count, tabIds and panelIds needs to get reset to 0 everytime we call ReactDOMServer.renderToString |
@zaiddag Have you forked and are creating a fix? |
@jamesjjk not yet, still not sure how to do this without add extra code to SSR implementation, will take a look this weekend |
Any idea when this fix will be released? Running into this issue and it's a blocker for taking this to production. |
Would a possible fix for this be to let the parent component pass an id generating function down? This would work for SSR, as a new function would be sent down for each request. Would be backwards-compatible too. If there is consensus on that, I could quickly hack that out. |
Hi! I'm having the same problem. Did you come up with a solution @neeharv ? |
@johonathan I've started work here - #129 Seems to work, but I'm still unsure if this is a long term solution. Adding an id constructor function to the public API surface seems icky. |
I'm consistently reproducing the error as well with varying numbers for each refresh on Here are the relevant bits of my use of
Thank you for your time. |
Hi there, I'm running in to the same issues as described above when server rendering. Just checking whether there is anything planned from the maintainers to address this issue / merge the PR? Thank you 😸 |
What confuses me here, what are the ids used for? Is it just for aria? If so, why can't the aria link be provided? If it's for actual behavior, why aren't refs used instead? |
I'm using react-tabs-isomorphic with ASP.NET Core / MVC with MobX. The tabs seem to work on both the client and server unless I also use mobx-react-devtools v4.2.11 With the devtools, the tab renders ok (no errors in the console) but I get an error when I try to change tabs. In react-dom.js it gets null for ReactDOMComponentTree.getInstanceFromNode(node) (starting with line 2035 in ReactDOM v15.4.2) The error is: Although the error is being thrown by ReactDOM it appears to be an issue that it cannot get the instance properly from the react-tabs component. I'm just starting to use MobX so I'd really like to use the developer tools if possible. |
This bug supposed to be fixed atm? I'm still getting checksum errors. |
I am still getting the warnings in the console about tab ids mismatch.
Do we need to configure something to fix this behaviour? |
@Nerlin @skyshader does this paragraph in the README have what you need? https://github.com/reactjs/react-tabs#resetidcounter-void |
@joepvl That solved it. Thanks a ton :) |
The chosen solution is bad as it requires annoying and fragile boilerplate on server side. Not to mention it's not thread safe and will supposedly break with NodeJS clusters. You'd better use https://github.com/ai/nanoid |
I'm still getting this warning in the console using Next.js ...
Any idea how to fix this? |
If you are using Next.js, import dynamic from 'next/dynamic'
const Tabs = dynamic(import('react-tabs').then(mod => mod.Tabs), { ssr: false }) // disable ssr
import { Tab, TabList, TabPanel } from 'react-tabs' |
This solution worked great for my project. Thanks, @Nases Note: I'm using typescript, so I had to pass TabsProps to get the prop types of Tabs: import { Tab, TabList, TabPanel, TabsProps } from 'react-tabs';
const Tabs = dynamic<TabsProps>(import('react-tabs').then(mod => mod.Tabs), { ssr: false }); |
Hi there is a checksum error when using serverside rendering..
(client) tab" id="react-tabs-0" aria-selected="tr
(server) tab" id="react-tabs-4" aria-selected="tr
Any ideas what it could be?
The text was updated successfully, but these errors were encountered: