famedly / matrix-dart-sdk

Matrix SDK written in pure Dart.
GNU Affero General Public License v3.0
49 stars 31 forks source link

fix: Request user causing state update loops for apps #1854

Closed nico-famedly closed 1 month ago

nico-famedly commented 1 month ago

This completely redoes the requestUser function.

It now doesn't stop requesting a user forever just because of a network error. But redundant calls are still deduplicated, however their parameters are taken into account now.

It also now only calls onUpdate and onRoomState when there is actually new state. This way apps can just listen to updates to rerender instead of having to implement the deduplication themselves.

It also now doesn't treat member events without membership as "join" anymore. And lookup errors don't cause an empty user to get inserted into the room state.

In general this should still request the profile from the server, if the displayname is unset in a leave event, but it should also allow the app to actually settle in the tests.