diff --git a/src/app/features/common-settings/cosmetics/Cosmetics.tsx b/src/app/features/common-settings/cosmetics/Cosmetics.tsx
index f3a827b26..463468548 100644
--- a/src/app/features/common-settings/cosmetics/Cosmetics.tsx
+++ b/src/app/features/common-settings/cosmetics/Cosmetics.tsx
@@ -156,34 +156,44 @@ export function Cosmetics({ requestClose }: CosmeticsProps) {
variant="SurfaceVariant"
direction="Column"
gap="400"
- style={{ padding: '16px' }}
>
-
-
- /color [hex]
-
- Set room-specific name color. (e.g. /color #ff00ff)
-
-
-
- /font [name]
-
- Set room-specific name font. (e.g. /font monospace)
-
-
-
- /pronoun [pronouns]
-
- Set room-specific pronoun set. (e.g. /pronoun "they\them, it\its")
-
-
-
- /gcolor | /gfont | /gpronoun
-
- Apply colors/fonts/pronouns to the entire space.
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx
index 2157caef3..15c77115d 100644
--- a/src/app/features/room/RoomTimeline.tsx
+++ b/src/app/features/room/RoomTimeline.tsx
@@ -75,6 +75,8 @@ import {
renderMatrixMention,
} from '$plugins/react-custom-html-parser';
import {
+ roomHaveNotification,
+ roomHaveUnread,
canEditEvent,
decryptAllTimelineEvent,
getEditedEvent,
@@ -259,6 +261,7 @@ type RoomTimelineProps = {
};
const PAGINATION_LIMIT = 60;
+const EVENT_TIMELINE_LOAD_TIMEOUT_MS = 12000;
type Timeline = {
linkedTimelines: EventTimeline[];
@@ -273,12 +276,38 @@ const useEventTimelineLoader = (
) =>
useCallback(
async (eventId: string) => {
+ const withTimeout = async (promise: Promise, timeoutMs: number): Promise =>
+ new Promise((resolve, reject) => {
+ const timeoutId = window.setTimeout(() => {
+ reject(new Error('Timed out loading event timeline'));
+ }, timeoutMs);
+
+ promise
+ .then((value) => {
+ window.clearTimeout(timeoutId);
+ resolve(value);
+ })
+ .catch((error) => {
+ window.clearTimeout(timeoutId);
+ reject(error);
+ });
+ });
+
if (!room.getUnfilteredTimelineSet().getTimelineForEvent(eventId)) {
- await mx.roomInitialSync(room.roomId, PAGINATION_LIMIT);
- await mx.getLatestTimeline(room.getUnfilteredTimelineSet());
+ await withTimeout(
+ mx.roomInitialSync(room.roomId, PAGINATION_LIMIT),
+ EVENT_TIMELINE_LOAD_TIMEOUT_MS
+ );
+ await withTimeout(
+ mx.getLatestTimeline(room.getUnfilteredTimelineSet()),
+ EVENT_TIMELINE_LOAD_TIMEOUT_MS
+ );
}
const [err, replyEvtTimeline] = await to(
- mx.getEventTimeline(room.getUnfilteredTimelineSet(), eventId)
+ withTimeout(
+ mx.getEventTimeline(room.getUnfilteredTimelineSet(), eventId),
+ EVENT_TIMELINE_LOAD_TIMEOUT_MS
+ )
);
if (!replyEvtTimeline) {
onError(err ?? null);
@@ -359,31 +388,34 @@ const useTimelinePagination = (
}
fetching = true;
- const [err] = await to(
- mx.paginateEventTimeline(timelineToPaginate, {
- backwards,
- limit,
- })
- );
- if (err) {
- // TODO: handle pagination error.
- return;
- }
- const fetchedTimeline =
- timelineToPaginate.getNeighbouringTimeline(
- backwards ? Direction.Backward : Direction.Forward
- ) ?? timelineToPaginate;
- // Decrypt all event ahead of render cycle
- const roomId = fetchedTimeline.getRoomId();
- const room = roomId ? mx.getRoom(roomId) : null;
+ try {
+ const [err] = await to(
+ mx.paginateEventTimeline(timelineToPaginate, {
+ backwards,
+ limit,
+ })
+ );
+ if (err) {
+ // TODO: handle pagination error.
+ return;
+ }
+ const fetchedTimeline =
+ timelineToPaginate.getNeighbouringTimeline(
+ backwards ? Direction.Backward : Direction.Forward
+ ) ?? timelineToPaginate;
+ // Decrypt all event ahead of render cycle
+ const roomId = fetchedTimeline.getRoomId();
+ const room = roomId ? mx.getRoom(roomId) : null;
- if (room?.hasEncryptionStateEvent()) {
- await to(decryptAllTimelineEvent(mx, fetchedTimeline));
- }
+ if (room?.hasEncryptionStateEvent()) {
+ await to(decryptAllTimelineEvent(mx, fetchedTimeline));
+ }
- fetching = false;
- if (alive()) {
- recalibratePagination(lTimelines, timelinesEventsCount, backwards);
+ if (alive()) {
+ recalibratePagination(lTimelines, timelinesEventsCount, backwards);
+ }
+ } finally {
+ fetching = false;
}
};
}, [mx, alive, setTimeline, limit]);
@@ -450,6 +482,8 @@ const getEmptyTimeline = () => ({
});
const getRoomUnreadInfo = (room: Room, scrollTo = false) => {
+ if (!roomHaveNotification(room) && !roomHaveUnread(room.client, room)) return undefined;
+
const readUptoEventId = room.getEventReadUpTo(room.client.getUserId() ?? '');
if (!readUptoEventId) return undefined;
const evtTimeline = getEventTimeline(room, readUptoEventId);
@@ -718,7 +752,6 @@ export function RoomTimeline({
highlight,
});
} else {
- setTimeline(getEmptyTimeline());
loadEventTimeline(evtId);
}
},
@@ -815,20 +848,10 @@ export function RoomTimeline({
useCallback(
(inFocus) => {
if (inFocus && atBottomRef.current) {
- if (unreadInfo?.inLiveTimeline) {
- handleOpenEvent(unreadInfo.readUptoEventId, false, (scrolled) => {
- // the unread event is already in view
- // so, try mark as read;
- if (!scrolled) {
- tryAutoMarkAsRead();
- }
- });
- return;
- }
tryAutoMarkAsRead();
}
},
- [tryAutoMarkAsRead, unreadInfo, handleOpenEvent]
+ [tryAutoMarkAsRead]
)
);
@@ -1000,7 +1023,6 @@ export function RoomTimeline({
const handleJumpToUnread = () => {
if (unreadInfo?.readUptoEventId) {
- setTimeline(getEmptyTimeline());
loadEventTimeline(unreadInfo.readUptoEventId);
}
};
diff --git a/src/app/features/settings/about/About.tsx b/src/app/features/settings/about/About.tsx
index 1e83a947f..15c4b65a5 100644
--- a/src/app/features/settings/about/About.tsx
+++ b/src/app/features/settings/about/About.tsx
@@ -67,7 +67,7 @@ export function About({ requestClose }: AboutProps) {