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

Question about collaborative chat shared document #25

Closed
brichet opened this issue Apr 25, 2024 · 0 comments · Fixed by #31
Closed

Question about collaborative chat shared document #25

brichet opened this issue Apr 25, 2024 · 0 comments · Fixed by #31
Labels
enhancement New feature or request

Comments

@brichet
Copy link
Collaborator

brichet commented Apr 25, 2024

The shared document in collaborative chat is a JSON formatted as the following:

{
  "messages": {
    "msg_id1": {
      "type": "msg",
      "id": "f7843bee-7e40-4659-84f6-552d492befd3",
      "body": "Hello World!",
      "time": 1714057210.97,
      "sender": "4480f9e7ffc847b3b657d8681ba3a4c8"
    }
  },
  "users": {
    "4480f9e7ffc847b3b657d8681ba3a4c8": {
      "name": "Anonymous Thyone",
      "avatar_url": null,
      "initials": "AT",
      "username": "4480f9e7ffc847b3b657d8681ba3a4c8",
      "color": "var(--jp-collaborator-color7)",
      "display_name": "Anonymous Thyone"
    }
  }
}

Problem

Structuring the messages as a Map is better for message manipulation (edition, deletion), but bring some drawback in comparison with an Array:

  • the file is hardly readable without the widget, since the messages will not be ordered.
  • if we expect to do some lazy loading for large file (loading only the last messages), it will be less performant if the messages are not ordered.

Proposed Solution

Switch back to an Array for the messages.
This structure has been changed in #18 (the first idea of the PR was to add the users section).
The part about the messages could be reverted for better readability.

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

Successfully merging a pull request may close this issue.

1 participant