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

238
Views
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
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!