Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52a9da18f2 | ||
|
|
9b3956d85f |
@@ -117,6 +117,9 @@ export default [
|
||||
|
||||
// Matrix video events carry no caption field, so there is no caption source to read.
|
||||
'jsx-a11y/media-has-caption': 'off',
|
||||
|
||||
// Prism tokens are not unique within a line, so the array index is the only key available.
|
||||
'react/no-array-index-key': 'off',
|
||||
},
|
||||
},
|
||||
].flatMap((config) =>
|
||||
|
||||
@@ -136,7 +136,6 @@ function CompareEmoji({ sasData }: { sasData: ShowSasCallbacks }) {
|
||||
>
|
||||
{sasData.sas.emoji?.map(([emoji, name], index) => (
|
||||
<Box
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={`${emoji}${name}${index}`}
|
||||
direction="Column"
|
||||
gap="100"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/no-array-index-key */
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { Badge, Box, Button, Chip, config, Menu, Spinner, Text } from 'folds';
|
||||
import { EventType } from 'matrix-js-sdk';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/no-array-index-key */
|
||||
import React, { useState, MouseEventHandler, ReactNode } from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import {
|
||||
|
||||
@@ -180,7 +180,6 @@ export function ForumPostUploadField({
|
||||
.reverse()
|
||||
.map((fileItem, index) => (
|
||||
<UploadCardRenderer
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={index}
|
||||
isEncrypted={!!fileItem.encInfo}
|
||||
fileItem={fileItem}
|
||||
|
||||
@@ -635,7 +635,6 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
|
||||
.reverse()
|
||||
.map((fileItem, index) => (
|
||||
<UploadCardRenderer
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={index}
|
||||
isEncrypted={!!fileItem.encInfo}
|
||||
fileItem={fileItem}
|
||||
|
||||
@@ -167,14 +167,21 @@ export function ClientRoot({ children }: ClientRootProps) {
|
||||
// first sync) can not leave the splash up forever.
|
||||
const splashDeadline = useRef<number | undefined>(undefined);
|
||||
|
||||
const scheduleHide = useCallback((reason?: string) => {
|
||||
if (splashHoldTimer.current !== undefined) return;
|
||||
// The splash particles animate for 450ms with up to 640ms of stagger. Hold only
|
||||
// for whatever is left of that, so a load that already took longer swaps at once.
|
||||
const splashShownAt = useRef(performance.now());
|
||||
const splashHidden = useRef(false);
|
||||
|
||||
if (reason) console.log(`[ClientRoot] Hiding splash: ${reason}`);
|
||||
const scheduleHide = useCallback((reason?: string) => {
|
||||
if (splashHidden.current) return;
|
||||
|
||||
const hold = Math.max(0, 1100 - (performance.now() - splashShownAt.current));
|
||||
if (reason) console.log(`[ClientRoot] Hiding splash: ${reason} (hold ${Math.round(hold)}ms)`);
|
||||
splashHidden.current = true;
|
||||
splashHoldTimer.current = window.setTimeout(() => {
|
||||
splashHoldTimer.current = undefined;
|
||||
setLoading(false);
|
||||
}, 1500);
|
||||
}, hold);
|
||||
}, []);
|
||||
|
||||
// The UI renders chats from the room-list atoms, which are filled by
|
||||
@@ -182,10 +189,9 @@ export function ClientRoot({ children }: ClientRootProps) {
|
||||
// so the first paint after the splash already contains the chats.
|
||||
const roomsAtom = useAtomValue(allRoomsAtom);
|
||||
const directsAtom = useAtomValue(mDirectAtom);
|
||||
const chatsReady =
|
||||
roomsAtom.length > 0 &&
|
||||
directsAtom.size > 0 &&
|
||||
roomsAtom.some((roomId) => directsAtom.has(roomId));
|
||||
// An account with no direct chats can never satisfy a gate that requires one, so it
|
||||
// always waits for the deadline. Gate on the rooms only.
|
||||
const chatsReady = roomsAtom.length > 0;
|
||||
|
||||
const tryHide = useCallback(
|
||||
(reason: string): boolean => {
|
||||
@@ -285,12 +291,10 @@ export function ClientRoot({ children }: ClientRootProps) {
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
const poll = window.setInterval(check, 400);
|
||||
mx.on(ClientEvent.Room, check);
|
||||
mx.on(ClientEvent.AccountData, check);
|
||||
|
||||
return () => {
|
||||
window.clearInterval(poll);
|
||||
mx.removeListener(ClientEvent.Room, check);
|
||||
mx.removeListener(ClientEvent.AccountData, check);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user