Watts-Lab / deliberation-empirica

Empirica V2 framework
MIT License
6 stars 0 forks source link

debug blank-screen error #716

Closed JamesPHoughton closed 10 months ago

JamesPHoughton commented 10 months ago

In the so good experiment, moving to the page with the video discussion, saw a blank screen with this error:

Image

The error string resolves to: https://legacy.reactjs.org/docs/error-decoder.html/?invariant=310 "Rendered more hooks than during the previous render"

But on refreshing the page, there were no problems. Also had no problems in safari.

JamesPHoughton commented 10 months ago

Looks like it's in the VideoCall component. We have an if statement with a return before several hooks:

 if (!player || !game || !stageTimer || !roomUrl)
    return (
      <H3> Loading meeting room. This should take ~30 seconds or less. </H3>
    );

  const stageElapsed = (stageTimer?.elapsed || 0) / 1000;
  const stageStartedAt = Date.now() / 1000 - stageElapsed;

  const dailyElement = useRef(null);
  const [callFrame, setCallFrame] = useState(null);

so if the if statement triggers then it could cause this error.

JamesPHoughton commented 10 months ago

Rewrote VideoCall component so that it doesn't have a premature return, and properly uses useEffect dependencies.