Skip to content

Avoid deleting messages #203

Open
Open
@brichet

Description

@brichet

It seems like there's a couple of issues that can occur when deleting messages from the list. Managing the index of each message in the array of chat messages introduces a fair amount of complexity throughout the codebase.

I wonder if it would be simpler to never delete elements from the list of chat messages, and completely ignore indexes. Message deletion can be expressed as a message edit. For example, deleting a message is kind of the same as just marking it as deleted and showing "message deleted" in the UI.

If we follow this pattern throughout Jupyter Chat, this brings two major benefits:

  1. We always know exactly what index each message is.
  2. We don't have to ever update that index or re-calculate indices.

This is also essentially free in terms of memory use. In Yjs, items are never deleted, but simply marked as deleted in the data model. Therefore deleting a message doesn't really save any significant amount of memory anyways. If this change can simplify the codebase, I think we should take this opportunity.

@brichet What do you think?

Originally posted by @dlqqq in #194 (review)

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