Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KucherenkoSerhiy opened this issue Mar 11, 2023 · 2 comments
Open

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

KucherenkoSerhiy opened this issue Mar 11, 2023 · 2 comments

Comments

@KucherenkoSerhiy
Copy link

KucherenkoSerhiy commented Mar 11, 2023

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
    }
  ]
}
@mrozbarry
Copy link
Collaborator

What is better when dropping an item:

  1. it disappears
  2. It reappears
  3. The drop is invalidated (similar to 1 but the dragging user gets notified)

@KucherenkoSerhiy
Copy link
Author

KucherenkoSerhiy commented Mar 11, 2023

@mrozbarry IMO option 2 (it reappears) is better, as it is much easier to click a button to delete than to write the whole thing again.

Edit: since the whole story happens due to a miscommunication in a team, getting their back should be a nice touch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants