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