empiricaly / empirica

Open source project to tackle the problem of long development cycles required to produce software to conduct multi-participant and real-time human experiments online.
https://empirica.ly/
Apache License 2.0
44 stars 8 forks source link

The value of usePlayers is sometimes undefined #455

Closed npaton closed 7 months ago

npaton commented 9 months ago

Is there an existing issue for this?

What happened?

The usePlayers sometimes returns undefined, while it shouldn't. usePlayer and useGame, at the same time, are returning something. In no circumstance should usePlayers be undefined while the others are defined. It seems that it's a loading issue. If you check for undefined, and wait shortly, it will become available relatively quickly.

Steps To Reproduce

  1. Reload the experiment in the middle of a stage and use usePlayers, and it's sometimes undefined

Empirica Version

1.8.9

What OS are you seeing the problem on?

No response

What browser are you seeing the problem on?

No response

Relevant log output

No response

Anything else?

It's likely waiting to have all the players loaded to return anything. Question is:

  1. do we return before all players have loaded (partial list inside usePlayers)
  2. do we wait to have all players loaded before we allow the app to render (probably preferable)

Code of Conduct

frasalvi commented 8 months ago

Encountered this (thanks to Sentry) with one participant that had a bad connection and kept disconnecting and reconnecting.