Skip to content

Make sure there are no null objects returned from backend #287

@KucherenkoSerhiy

Description

@KucherenkoSerhiy

Why: A parallel user interaction may block a room (forever). Here is an example:

Assume 2 persons in the same room with some goals. Then, the following happens:

  • User 1 starts dragging one of the goals
  • User 2 removes the goal
  • User 1 finishes his operation by dropping a goal

At this point, the room is blocked: no view buttons react to clicks, as the following console error appears:

Uncaught TypeError: Cannot read properties of null (reading 'completed')
at index.js:19:41
at Array.filter ()
at getGoalsDetails (index.js:19:27)
at tabs (index.js:70:20)
at view (timer.js:77:13)
at render (index.js?module=1:393:10)

The error is caused because the "GET wss://mobti.me/room" call returns a null goal alongside others:

{
  "type": "goals:update",
  "goals": [
    {
      "id": "...",
      "text": "...",
      "completed": true
    },
    null,
    {
      "id": "...",
      "text": "...",
      "completed": false
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions