#height is not the correct height of the parent
1 messages · Page 1 of 1 (latest)
Hi @frail cobalt. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Hmm, I don't know enough to give you a confident answer yet. However, based on the information provided, it seems like you're dealing with a dynamic height issue. One of the users in the Github issue (https://github.com/vercel/next.js/issues/47839) mentioned a similar problem where the initial height on the first load changes. They managed to fix it by storing the initial height and forcing it back via CSS or JS.
Here's a simplified version of their solution:
- Store the initial height of the document using
document.documentElement.clientHeightin a<Script strategy="beforeInteractive">tag in_document.tsx. - In a
useLayoutEffect, check ifdocument.documentElement.clientHeighthas changed. - If it has changed, manually set your
<main>element's height.