Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: canRequestHistory is true while requestHistory throws an excepti… #1595

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/src/timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class Timeline {
bool _collectHistoryUpdates = false;

bool get canRequestHistory {
if (events.isEmpty) return true;
return room.prev_batch != null && events.last.type != EventTypes.RoomCreate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can only access events.last, if events is not empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the normal room history, events should never have to be empty, since we should always be able to request our own history for our join event at least. This also might cause issues, since possibly on the first history pagination a timeline has no prev_batch token and is empty, if you just want to request the history for an arbitrary room? Not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay true, somehow I have missread the whole method. Will close this then

}

Expand Down
Loading