-
-
Notifications
You must be signed in to change notification settings - Fork 830
Ask to refresh timeline when historical messages are imported (MSC2716) #8354
Ask to refresh timeline when historical messages are imported (MSC2716) #8354
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearing code review
Codecov Report
@@ Coverage Diff @@
## develop #8354 +/- ##
===========================================
+ Coverage 30.01% 30.09% +0.07%
===========================================
Files 879 879
Lines 50193 50220 +27
Branches 12783 12791 +8
===========================================
+ Hits 15064 15112 +48
+ Misses 35129 35108 -21
|
if (timelineSet !== this.props.timelineSet) return; | ||
|
||
if (this.messagePanel.current && this.messagePanel.current.isAtBottom()) { | ||
if (this.canResetTimeline()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a missed refactor. canResetTimeline
by name seems applicable here and the logic appears pretty equivalent.
matrix-react-sdk/src/components/structures/RoomView.tsx
Lines 1004 to 1009 in 27118a9
public canResetTimeline = () => { | |
if (!this.messagePanel) { | |
return true; | |
} | |
return this.messagePanel.canResetTimeline(); | |
}; |
public canResetTimeline = () => this.messagePanel?.current.isAtBottom(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split out to #10403
See: ``` Error: src/utils/ErrorUtils.tsx(39,5): error TS1016: A required parameter cannot follow an optional parameter. ```
test/components/structures/__snapshots__/RoomView-test.tsx.snap
Outdated
Show resolved
Hide resolved
…msc2716-marker-events-v2 Conflicts: src/components/structures/MessagePanel.tsx src/components/views/rooms/EventTile.tsx src/i18n/strings/en_EN.json test/components/structures/__snapshots__/RoomView-test.tsx.snap
What's the state of this change? It looks like a huge amount of work has gone into it, and it's been around for ~6 months! |
@andybalaam The implementation on this side has been ready to go since April 20th when it had the review pass. And I've kept it up to date at various points (whenever I merge It's been blocked behind the refresh timeline function in the I'm focusing on other things so I guess it will continue to languish 🗻 |
OK so @MadLittleMods it doesn't look like you're blocked on us for anything here - just needing to find time to respond to review requests on matrix-org/matrix-js-sdk#2852 . Let me know if we can help. |
// The submit debug logs option should *NOT* be shown. | ||
// | ||
// We have to use `queryBy` so that it can return `null` for something that does not exist. | ||
expect(wrapper.queryByTestId('historical-import-detected-error-submit-debug-logs-button]')).toBeNull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(wrapper.queryByTestId('historical-import-detected-error-submit-debug-logs-button]')).toBeNull(); | |
expect(wrapper.queryByTestId('historical-import-detected-error-submit-debug-logs-button')).toBeNull(); |
if (this.state.refreshError) { | ||
let errorTextContent; | ||
let submitDebugLogsTextContent; | ||
if (this.state.refreshError.name === "ConnectionError") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the pattern we ended up with in #10405
Abandoning PR as I don't see MSC2716 going further now that Gitter has fully migrated to Matrix |
… (nonsense to screenreaders) (#10402) And the other content like the title already describe what's going on sufficiently. Split out from matrix-org/matrix-react-sdk#8354
Ask to refresh timeline when historical messages are imported (MSC2716)
Associated
matrix-js-sdk
PR: matrix-org/matrix-js-sdk#2299Loading state:
Error state for network errors (no need to submit debug logs):
Error state for other errors you can submit debug logs:
Beware: edge case
There is one edge case where the "History import detected" banner can re-appear after you have refreshed the timeline.
matrix-js-sdk
only persists/sync
data to IndexDB every 5 minutes which means it can have a stalenext_batch
pagination token compared to the latest events you might be seeing on screen. So if you receive amarker
event, it will show the banner to refresh the timeline. You can then use the button to refresh your timeline and the banner will disappear as expected. Then if you restart your entire Element client (like refreshing the entire browser), Element willsyncFromCache
with the/sync
response from 5 minutes ago and query/sync
with that old pagination token which will fetch themarker
event again and show the banner again.Testing strategy
homeserver.yaml
, enableexperimental_features
->msc2716_enabled: true
POST http://localhost:8008/_matrix/client/v3/createRoom
with?prev_event_id
parameter for the batch send request:POST http://localhost:8008/_matrix/client/unstable/org.matrix.msc2716/rooms/{roomId}/batch_send?prev_event_id={someEventId}
withbase_insertion_event_id
from the batch send response in theorg.matrix.msc2716.marker.insertion
field in the JSON body:PUT http://localhost:8008/_matrix/client/r0/rooms/{roomId}/state/org.matrix.msc2716.marker
Refresh timeline
buttonDev notes
First reviewed in #8303
Generic apply
data-xxx
attributes to to child components (based off of https://stackoverflow.com/a/65656589/796832):Cypress
Clean up Synapse Docker instances from Cypress
Can't queue within
cy.intercept
callbacksError:
Snippet without
async
still fails ❌Snippet with async use case fails too ❌
Related issues:
cy.intercept(..., { forceNetworkError: true })
does not play well with multiple matching requests or overridingBut if you try to override a
cy.intercept
that usesforceNetworkError
, the second match will always fail. Both of the following examples work if you just switch it out for{ statusCode: 500 }
instead of the network failureSnippet trying to override intercepts ❌
Snippet trying to conditionally fail/passthrough request ❌
Related issues:
Debugging Synapse in the Cypress e2e tests
In
cypress/plugins/synapsedocker/index.ts#L124
, change the image that thesynapsedocker
Cypress plugin is using to spin up Synapse instances tomatrixdotorg/synapse:latest
. Restart your Cypress process.In your local Synapse checkout, make any changes and build the image:
docker build -t matrixdotorg/synapse -f docker/Dockerfile .
Logging code in Synapse to generate the tabulated events from the room you're interested in:
Example output:
Todo
matrix-js-sdk
to actually refresh the timeline, Ask to refresh timeline when historical messages are imported (MSC2716) #8303 (comment)Here's what your changelog entry will look like:
✨ Features
Preview: https://pr8354--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.