Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

239
Visualizações
MERN: Refresh loads raw data

Why does my deployed MERN app return raw data on page refresh?

When a specific get request is called, raw data from mongo displays on the screen like this. I just deployed to Heroku and this issue does not happen on my local server. My thinking is that the issue could be with Editor.js, however, a boolean state change is used to delay render until all data is loaded.

The data returned is correct, so the Axios call is successful. It's just weird that the React component isn't being rendered.

On refresh, this is called:

 useEffect(() => {
    initialDataLoadEditor();
  }, []);

  async function initialDataLoadEditor() {
    try {
      const response = await axios.get(`/document/${id}`);

      setData(response.data);
      setIsLoaded(true);
    } catch (error) {
      console.error(error);
    }
  }

if (isLoaded === false) {
    return <div>LOADING...</div>;
  } return (
      <div>

        <div className='flex justify-center'>
          <label >
            <TextareaAutosize
              className={`  mt-2 mb-2  flex-child outline-none resize-none text-2xl font-bold`}
              type="text"
              ref={nameRef}
              defaultValue={data.name}
              onChange={(e) => handleSave(e)}
            />
          </label>
        </div>

        <EditorJs
          instanceRef={(instance) => (instanceRef.current = instance)}
          placeholder="Start typing what's in your head..."
          tools={EDITOR_JS_TOOLS}
          enableReInitialize={true}
          data={data.components[0]}
          onChange={(e) => handleSave(e)}
        />
      </div>
    );

Been working on this since the AM and I'm really not sure what's going on. Any idea how to render the React component? Thank you!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda