question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Describe the bug

Differences in generated HTML on server and client cause a warning in Next.js:

react-dom.development.js:67 Warning: Prop aria-controls did not match. Server: “collapsible-content-1632766367544” Client: “collapsible-content-1632766370864”

Currently it needs to be patched or excluded from server rendering to avoid the issue.

It’s expected that this also causes problems with React server renderer in general.

To Reproduce

Use the component with Next.js

Expected behavior

The component could provide a way to override this behaviour for content id similarly to how it’s done for trigger id with triggerElementProps.

Additional context

react-collapsible@2.8.4 next@11.1.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
glennflanagancommented, Nov 4, 2021

I think if add the ability to override this.contentId this would be a quick workaround? The users using SSR can set it theirselves preventing the difference at re-hydration

3reactions
stephankcommented, Aug 8, 2022

React 18 added a useId hook for this purpose. I’m using a simple wrapper around Collapsible that looks like:

import { useId } from 'react'
import BaseCollapsible, { CollapsibleProps } from 'react-collapsible'

export function Collapsible(props: CollapsibleProps) {
  const id = useId()

  return (
    <BaseCollapsible
      {...props}
      contentElementId={`collapsible-content-${id}`}
      triggerElementProps={{
        ...props.triggerElementProps,
        id: `collapsible-trigger-${id}`,
      }}
    />
  )
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

SSR problems and issues | Chevy SSR Forum
Hi, all. I just joined because I have been searching for an SSR and would like to know what the known issues are...
Read more >
Chevrolet SSR - problems, statistics, and analysis
The following chart shows the 16 most common problems for Chevrolet SSR cars. The number one most common problem is related to the...
Read more >
The Real Reason The Chevrolet SSR Failed - HotCars
It seems like an automobile that suffered from “wrong place, wrong time” syndrome. There was a lot of hype for the SSR before...
Read more >
Chevy SSR Transmission Problems & Cost
Problem – A common Chevrolet SSR transmission problem is an intermittent hard 1-2 shift, often accompanied by engine bogging. This condition can be...
Read more >
2004 Chevrolet SSR Problems | Kelley Blue Book
How reliable is the 2004 Chevrolet SSR? See the most common repairs performed and learn if your vehicle is at risk for major...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found