-
Notifications
You must be signed in to change notification settings - Fork 0
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
Peeking unknown rooms #3
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.
This is looking great, looking forward to having this feature in hydrogen! Well done!
I noticed that when viewing large rooms there is a long delay between the UI first rendering and the timeline appearing, so I think we would probably need to show a loading state before the timeline actually renders:
Screen.Recording.2023-02-10.at.15.37.18.mov
0762625
to
647d8a4
Compare
@psrpinto Thanks for the great suggestions! <3 Could you explain the issue in your screencast? |
} | ||
try { | ||
this._room = await this._session.loadWorldReadableRoom(this.roomIdOrAlias); | ||
const timeline = await this._room.openTimeline(); |
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.
Interesting ... how does this work if you don't already have a fragment of the timeline stored? If I understand things correctly, at this point, the room exists solely in-memory and nothing related has been written to storage, right? So what token do you end up calling /messages with? I might very well be missing something :)
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.
Actually loadWorldReadableRoom()
above it does all of that - creates the Room object instance, fetch events from messages endpoint & load it all. You will see that here - https://github.com/Automattic/hydrogen-web/pull/3/files#diff-25d3af8c52953975b54837c62ef3195e1054638339aa9b1a9c1d6bc267cdadc8R962
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.
Could you explain the issue in your screencast?
How were you able to even trigger the timeline to load for you?
In the screen recording I'm using #matrix:matrix.org
as an example (!OGEhHVWSdvArJzumhm:matrix.org
). I'm not a member of that room but I think I was a member and then left, that's why the last message on the timeline is @psrpinto:matrix.org left the room
.
So that might explain why the timeline renders for me, which would mean that we would have to take that scenario in account.
But what should we do? Should we:
- Render the
UnknownRoomView
and show the latest messages - Don't render the
UnknownRoomView
and let hydrogen take care of it. Hydrogen already shows the timeline if you left the room, I believe.
At the moment we're in the middle of 1. and 2., where we show the UnknownRoomView
with not the most recent messages.
matrix.org
doesn't allow previews on their rooms if you are not in the room and hence peeking can't be functional for those rooms.
By "doesn't allow" you mean that you can't call the /messages
endpoint for the room if you're not a member?
Actually, on Am I going crazy? I thought I'd seen hydrogen rendering the timeline for rooms you left, with history up to the point you left, and a message in the bottom saying "You left the room". |
That would be the timeline you saw for an archive room. Unless we choose to forget the room, UnknownRoomView doesn't come into the picture and by then peeking functionality handles it.
Correct! If you try to peek into matrix hq room, you will see console errors stating previews are disabled. I tried peeking into I think you got confused by the archive room timeline view after leaving the room. |
@psrpinto and I discussed this more and it turns out this happens when you try to peek into a room that you earlier were a member in but not anymore. Weirdly enough matrix.org has room previews disabled if you are trying to peek from another homeserver but if you are logged in with an account on matrix.org, it lets you preview but with this edge case of /messages endpoint acting up. I will continue to look into this. Also while trying to figure this out, I was happy to learn that back scrolling is functional as is :) |
932b34d
to
7596057
Compare
…e by fetching messages and storing in the indexed db tables
…ligned with Matrix spec
579a1c5
to
098067f
Compare
Co-authored-by: Paulo Pinto <[email protected]>
…nd loading things async and updating view as we do This shows a spinner on UnknownRoomView stating "checking preview capability" and goes away when done and if room is world_readable, then renders the timeline with the last 100 messages
098067f
to
654cdf0
Compare
Created PR on upstream - element-hq#1037 so closing this PR |
PR meant for review (not for merge)