Watts-Lab / deliberation-empirica

Empirica V2 framework
MIT License
5 stars 0 forks source link

🐞Missing player, round hooks #822

Closed JamesPHoughton closed 3 weeks ago

JamesPHoughton commented 4 weeks ago

Sentry is reporting errors using properties of hooks,

in exit steps:

https://watts-lab.sentry.io/issues/5212693155/events/138db482108740239371a0e251c3bcf7/

undefined is not an object (evaluating 'game.get')
function exitSteps({ game }) {
    const steps = [];
    const treatment = game.get("treatment");
...
JamesPHoughton commented 4 weeks ago

In retrospect, I think this is happening in intro and exit steps, and that we successfully catch the issues during the game itself.

Nicolas suggests:

The empirica useX hooks use context internally. If you do if (!player) return ; at the top of your render tree, then player should always be available below that. This is actually what we're doing for "managed" games: https://github.com/empiricaly/empirica/blob/main/lib/%40empirica/core/src/player/classic/react/EmpiricaContext.tsx#L221-L254

sentry-io[bot] commented 3 weeks ago

Sentry Issue: DELIBERATION-EMPIRICA-79

sentry-io[bot] commented 3 weeks ago

Sentry Issue: DELIBERATION-EMPIRICA-70

sentry-io[bot] commented 3 weeks ago

Sentry Issue: DELIBERATION-EMPIRICA-6Z

sentry-io[bot] commented 3 weeks ago

Sentry Issue: DELIBERATION-EMPIRICA-6Y