matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

Add event with m.reference relation to unknown parent to the timeline.

Open maheichyk opened this issue 11 months ago • 1 comments

Currently event with m.reference relation to unknown parent event is not added to the timeline and therefore is not feed into the widget.

StopGapWidget.ts checks event to be in the timeline before the marker and if event is not found and marker is there then the event is ignored.

We in the widgets rely on this setup that a room event relates to another parent room event via m.reference and if parent event is not loaded (that happens when timeline is relatively big and user have to scroll timeline manually to get event loaded) the event is ignored.

Therefore this PR suggest to add this event to the timeline.

Checklist

  • [x] Tests written for new code (and old code if feasible)
  • [x] Linter and other CI checks pass
  • [x] Sign-off given on the changes (see CONTRIBUTING.md)

Type: defect

maheichyk avatar Feb 26 '24 06:02 maheichyk

@dbkr, @robintown I somehow cannot add a label (adding Type: defect to the PR description and I think it was working before to me) but all other checks are passing, please review.

maheichyk avatar Feb 26 '24 06:02 maheichyk

The main problem in relation to the widgets was resolved by another PR to matrix-react-sdk, although would be nice to have these events in the timeline to be shown by Element as well and not to have a special handling for the widgets.

maheichyk avatar Mar 08 '24 15:03 maheichyk

@maheichyk a very related issue is tracked in https://github.com/element-hq/element-web/issues/27132

t3chguy avatar Mar 08 '24 15:03 t3chguy

@maheichyk a very related issue is tracked in element-hq/element-web#27132

Yes, it is the same issue to me: event (with custom relation type) is ignored because the parent event is missing (not loaded yet) in the timeline. In our widget case I could see our custom events in the timeline when they are added by the widget with devtools, but when Element is reloaded I could not see any of those. I though that it was a synapse issue, but it was not, all widgets events could be loaded fine via relation to this parent event.

maheichyk avatar Mar 08 '24 16:03 maheichyk

Its a tricky topic, the spec doesn't clearly outline how non-standard relations should interact with threads, and getting this wrong means stuck notifications due to the client & server treating those events as contained in different timelines. Ideally the client would be told which thread/main timeline the event belongs to deterministically (either top level thread_id or a value in unsigned) https://github.com/matrix-org/matrix-spec-proposals/pull/4023 would be such a solution

t3chguy avatar Mar 08 '24 16:03 t3chguy