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 https://github.com/jupyterlab/jupyter-chat/pull/18 (the first idea of the PR was to add the users section).
The part about the messages could be reverted for better readability.
The shared document in collaborative chat is a JSON formatted as the following:
Problem
Structuring the messages as a
Map
is better for message manipulation (edition, deletion), but bring some drawback in comparison with anArray
:Proposed Solution
Switch back to an
Array
for the messages. This structure has been changed in https://github.com/jupyterlab/jupyter-chat/pull/18 (the first idea of the PR was to add theusers
section). The part about the messages could be reverted for better readability.