Fix the mechanical style rules. [skip build]

This commit is contained in:
2026-11-01 09:01:32 +11:00
parent 831ce01150
commit 9591d8d01b
42 changed files with 762 additions and 756 deletions
+3 -3
View File
@@ -268,13 +268,13 @@ export function useAutoJoinOnSpaceVisit(space: Room | undefined): void {
useEffect(() => {
if (!space || !settings.autoJoinSpaceRooms) {
return;
return undefined;
}
if (!isSpace(space)) {
return;
return undefined;
}
if (space.getMyMembership() !== Membership.Join) {
return;
return undefined;
}
const spaceId = space.roomId;
+8 -6
View File
@@ -154,9 +154,10 @@ export const useRoomMediaEvents = (room: Room) => {
for (const raw of response.chunk ?? []) {
const mEvent = await decryptEvent(raw);
const item = toMediaItem(mEvent);
if (!item || cache.seenIds.has(item.eventId)) continue;
cache.seenIds.add(item.eventId);
collected.push(item);
if (item && !cache.seenIds.has(item.eventId)) {
cache.seenIds.add(item.eventId);
collected.push(item);
}
}
if (collected.length >= TARGET_BATCH || !response.end) break;
@@ -212,9 +213,10 @@ export const useRoomMediaEvents = (room: Room) => {
for (let i = localEvents.length - 1; i >= 0; i -= 1) {
const mEvent = await decryptEvent(localEvents[i]);
const item = toMediaItem(mEvent);
if (!item || cache.seenIds.has(item.eventId)) continue;
cache.seenIds.add(item.eventId);
localFound.push(item);
if (item && !cache.seenIds.has(item.eventId)) {
cache.seenIds.add(item.eventId);
localFound.push(item);
}
}
if (cancelled) return;
+6 -5
View File
@@ -42,11 +42,12 @@ const MAX_AUTO_PAGE_COUNT = 50;
export function buildParentByRoomId(rooms: Iterable<IHierarchyRoom>): Map<string, string> {
const parentByRoomId = new Map<string, string>();
for (const room of rooms) {
if (!room?.room_id || !Array.isArray(room.children_state)) continue;
for (const childState of room.children_state) {
if (childState?.type !== StateEvent.SpaceChild) continue;
if (typeof childState.state_key !== 'string') continue;
parentByRoomId.set(childState.state_key, room.room_id);
if (room?.room_id && Array.isArray(room.children_state)) {
room.children_state.forEach((childState) => {
if (childState?.type !== StateEvent.SpaceChild) return;
if (typeof childState.state_key !== 'string') return;
parentByRoomId.set(childState.state_key, room.room_id);
});
}
}
return parentByRoomId;
+5 -4
View File
@@ -110,10 +110,11 @@ export function useOtherUserCollectibles(userId: string): CollectibleProfileFiel
] as const;
for (const [kind, collectible] of entries) {
if (!collectible) continue;
for (const [role, mxc] of Object.entries(collectible.assets)) {
const blobUrl = await getProfileAssetUrl(mx, mxc, useAuthentication);
if (blobUrl) urls[`${kind}:${role}`] = blobUrl;
if (collectible) {
for (const [role, mxc] of Object.entries(collectible.assets)) {
const blobUrl = await getProfileAssetUrl(mx, mxc, useAuthentication);
if (blobUrl) urls[`${kind}:${role}`] = blobUrl;
}
}
}
+6 -4
View File
@@ -97,12 +97,12 @@ export function useTypingVerbs(userIds: string[]): Record<string, string | undef
if (!cancelled) setTick((tick) => tick + 1);
};
for (const userId of key.split(',')) {
if (getCachedProfileFields(userId)) continue;
key.split(',').forEach((userId) => {
if (getCachedProfileFields(userId)) return;
getProfileFields(mx, userId)
.then(rerender)
.catch(() => undefined);
}
});
return () => {
cancelled = true;
@@ -111,6 +111,8 @@ export function useTypingVerbs(userIds: string[]): Record<string, string | undef
}, [mx, key]);
const verbs: Record<string, string | undefined> = {};
for (const userId of userIds) verbs[userId] = getCachedTypingVerb(userId);
userIds.forEach((userId) => {
verbs[userId] = getCachedTypingVerb(userId);
});
return verbs;
}
+1 -1
View File
@@ -11,7 +11,7 @@ export const useViewTransitions = () => {
useEffect(() => {
if (!supportsViewTransitions()) {
return;
return undefined;
}
// Mark that we support view transitions