Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/fix-edit-button.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix edit button not always editing.
5 changes: 5 additions & 0 deletions .changeset/fix-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix search/nav/links/etc not loading messages.
5 changes: 5 additions & 0 deletions .changeset/fix-timeline-scroll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix timeline not sticking to the bottom in non-reduced motion setting.
5 changes: 5 additions & 0 deletions .changeset/replace-morg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Replace matrix.org with matrixrooms.info in default featured servers section.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"#PrivSec.dev:arcticfoxes.net",
"#disroot:aria-net.org"
],
"servers": ["matrix.org", "mozilla.org", "unredacted.org"]
"servers": ["matrixrooms.info", "mozilla.org", "unredacted.org"]
},

"hashRouter": {
Expand Down
37 changes: 21 additions & 16 deletions src/app/features/room/RoomTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,20 +214,12 @@ export function RoomTimeline({
const processedEventsRef = useRef<ProcessedEvent[]>([]);
const timelineSyncRef = useRef<typeof timelineSync>(null as unknown as typeof timelineSync);

const scrollToBottom = useCallback(
(behavior?: 'instant' | 'smooth') => {
if (!vListRef.current) return;
const lastIndex = processedEventsRef.current.length - 1;
if (lastIndex < 0) return;

if (behavior === 'smooth' && !reducedMotion) {
vListRef.current.scrollToIndex(lastIndex, { align: 'end', smooth: true });
} else {
vListRef.current.scrollTo(vListRef.current.scrollSize);
}
},
[reducedMotion]
);
const scrollToBottom = useCallback(() => {
if (!vListRef.current) return;
const lastIndex = processedEventsRef.current.length - 1;
if (lastIndex < 0) return;
vListRef.current.scrollTo(vListRef.current.scrollSize);
}, []);

const timelineSync = useTimelineSync({
room,
Expand Down Expand Up @@ -342,6 +334,18 @@ export function RoomTimeline({
};
}, [timelineSync.focusItem, timelineSync, reducedMotion, getRawIndexToProcessedIndex]);

useEffect(() => {
if (timelineSync.focusItem) {
setIsReady(true);
}
}, [timelineSync.focusItem]);

useEffect(() => {
if (!eventId) return;
setIsReady(false);
timelineSyncRef.current.loadEventTimeline(eventId);
}, [eventId, room.roomId]);

useEffect(() => {
if (eventId) return;
const { readUptoEventId, inLiveTimeline, scrollTo } = unreadInfo ?? {};
Expand Down Expand Up @@ -636,7 +640,8 @@ export function RoomTimeline({
: timelineSync.eventsLength;
const vListIndices = useMemo(
() => Array.from({ length: vListItemCount }, (_, i) => i),
[vListItemCount]
// eslint-disable-next-line react-hooks/exhaustive-deps
[vListItemCount, timelineSync.timeline]
);

const processedEvents = useProcessedTimeline({
Expand Down Expand Up @@ -857,7 +862,7 @@ export function RoomTimeline({
onClick={() => {
if (eventId) navigateRoom(room.roomId, undefined, { replace: true });
timelineSync.setTimeline(getInitialTimeline(room));
scrollToBottom('instant');
scrollToBottom();
}}
>
<Text size="L400">Jump to Latest</Text>
Expand Down
Loading