Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

208
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda