sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.14k stars 207 forks source link

chat: browser refresh opens editors of past messages #7662

Open haraldschilly opened 1 week ago

haraldschilly commented 1 week ago

This must be a fallout of the recent chat changes: if I send a message, then reply, then double click to edit the reply and cancel it (or something like that, i.e. nothing complex) → and then I refresh the entire page → I'm back into the chat but one of my past messages is shown in an additional edit box. This is weird, because the rendered message is also visible (I would assume either edit or render it, not both). In any case, something isn't quite right any more...

Screenshot from 2024-07-04 17-24-57


raw content of the file (redacting my account id):

{"active":1720106674603,"date":0,"event":"draft","input":" ","sender_id":"UUID"}
{"active":1720106674616,"date":-1720106660288,"event":"draft","input":"xxx","sender_id":"UUID"}
{"active":1720106678930,"date":1720106674584,"event":"draft","input":"xxx","sender_id":"UUID"}
{"date":"2024-07-04T15:24:20.288Z","editing":{},"event":"chat","history":[{"author_id":"UUID","content":"foo","date":"2024-07-04T15:24:20.288Z"}],"sender_id":"UUID"}
{"date":"2024-07-04T15:24:34.584Z","editing":{},"event":"chat","history":[{"author_id":"UUID","content":"xxx","date":"2024-07-04T15:24:34.584Z"}],"reply_to":"2024-07-04T15:24:20.288Z","sender_id":"UUID"}

WORKAROUND: click on "cancel" in all these edit boxes :man_shrugging:

williamstein commented 1 week ago

It's weird that the date is positive and negative for drafts, which is what is causing this. I'll just have it delete both signs for now.

haraldschilly commented 5 days ago

I'm reopening this, because I still see such messages. It's not related to refreshing and not easy to reproduce. They happen right when I just sent a message, or something like that. As if rendering the new chat with my message triggered an update, which makes the draft message reappear.