Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
How to show content from next.js DOM immediately?

I'm under the impression that the whole point of using SSR in Next.js is to have instant DOM render while react and other scripts are bootstrapped. However, when I throttle my connection, the page is just blank/white until the JS completes loading.

Here you can see the network preview (while throttling) shows the simple <div>LOADING</div> in the preview pane: enter image description here

But the browser sees nothing until scripts finish loading. It has the same behavior even if we render _app.tsx content (with router, lazy-loaded components etc). CURL to same address shows the desired HTML.

Here's the minimal _document.tsx that's used:

import { GetStaticPaths, GetStaticProps } from 'next';
import Document, { Html, Head, Main, NextScript } from 'next/document'

export default class MyDocument extends Document {
  static async getInitialProps(ctx) {
    const initialProps = await Document.getInitialProps(ctx)
    return { ...initialProps }
  }

  static getStaticProps: GetStaticProps = async () => {
    return { props: {} };
  };
  
  render() {
    return (
      <Html lang="en">
        <Head />
        <body className="bg-gray-100">
          <span style={{color: 'black', display: 'block', visibility: 'visible !important'}}>LOADING</span>
          <Main />
          <NextScript />
        </body>
      </Html>
    );
  }
}

Is something hiding the body's elements while scripts load? Am I not understanding how _document works?

Issue persists with all three fallbacks, too true false and blocking

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!