From 1e3d630b1a27420fdfd6e172308a8872860c3fa8 Mon Sep 17 00:00:00 2001 From: litruv Date: Mon, 2 Nov 2026 00:51:31 +1100 Subject: [PATCH] Fix the ref, upload, keyframes, and implicit-any type errors. [skip build] --- src/app/components/ConfirmPasswordMatch.tsx | 4 +- src/app/components/RouteTransition.tsx | 50 +++++++++---------- src/app/components/direct-list/DirectList.tsx | 2 +- src/app/components/emoji-board/EmojiBoard.tsx | 2 +- .../image-pack-view/ImagePackContent.tsx | 1 + .../ScrollTopContainer.tsx | 4 +- src/app/components/title-bar/TitleBar.css.ts | 25 +++++++--- src/app/components/title-bar/TitleBar.tsx | 2 +- .../UpdateNotification.css.ts | 19 ++++--- .../features/forum/ForumPostUploadField.tsx | 4 +- src/app/features/forum/ForumReplyComposer.tsx | 2 +- src/app/features/forum/ForumThreadDetail.tsx | 4 +- src/app/features/lobby/DnD.tsx | 6 +-- .../features/message-search/MessageSearch.tsx | 2 +- .../features/message-search/SearchInput.tsx | 2 +- src/app/features/room/RoomInput.tsx | 4 +- src/app/features/room/RoomTimeline.tsx | 4 +- src/app/features/search/Search.tsx | 2 +- src/app/hooks/useDebounce.ts | 2 +- src/app/hooks/useFileDrop.ts | 4 +- src/app/hooks/useInertialHorizontalScroll.ts | 2 +- src/app/hooks/useThrottle.ts | 4 +- src/app/hooks/useVirtualPaginator.ts | 24 +++++---- src/app/pages/client/ClientNonUIFeatures.tsx | 2 +- src/app/pages/client/explore/Server.tsx | 2 +- src/app/pages/client/sidebar/SpaceTabs.tsx | 12 ++--- src/app/utils/backgroundSync.ts | 31 ++++++++---- src/app/utils/copyHandler.ts | 2 +- src/app/utils/matrix.ts | 3 +- src/types/utils.ts | 5 ++ 30 files changed, 134 insertions(+), 98 deletions(-) diff --git a/src/app/components/ConfirmPasswordMatch.tsx b/src/app/components/ConfirmPasswordMatch.tsx index f4a66003..5918079c 100644 --- a/src/app/components/ConfirmPasswordMatch.tsx +++ b/src/app/components/ConfirmPasswordMatch.tsx @@ -6,8 +6,8 @@ type ConfirmPasswordMatchProps = { children: ( match: boolean, doMatch: () => void, - passRef: RefObject, - confPassRef: RefObject, + passRef: RefObject, + confPassRef: RefObject, ) => ReactNode; }; export function ConfirmPasswordMatch({ initialValue, children }: ConfirmPasswordMatchProps) { diff --git a/src/app/components/RouteTransition.tsx b/src/app/components/RouteTransition.tsx index 2ed46b76..029ff073 100644 --- a/src/app/components/RouteTransition.tsx +++ b/src/app/components/RouteTransition.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import { useLocation } from 'react-router-dom'; -import { style } from '@vanilla-extract/css'; +import { keyframes, style } from '@vanilla-extract/css'; const transitionContainer = style({ position: 'relative', @@ -14,36 +14,34 @@ const transitionContent = style({ height: '100%', }); +const routeFadeSlideIn = keyframes({ + from: { + opacity: 0, + transform: 'translateX(12px)', + }, + to: { + opacity: 1, + transform: 'translateX(0)', + }, +}); + const animateIn = style({ - animation: 'routeFadeSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1)', - '@keyframes': { - routeFadeSlideIn: { - from: { - opacity: 0, - transform: 'translateX(12px)', - }, - to: { - opacity: 1, - transform: 'translateX(0)', - }, - }, + animation: `${routeFadeSlideIn} 0.25s cubic-bezier(0.4, 0, 0.2, 1)`, +}); + +const routeFadeSlideOut = keyframes({ + from: { + opacity: 1, + transform: 'translateX(0)', + }, + to: { + opacity: 0, + transform: 'translateX(-12px)', }, }); const animateOut = style({ - animation: 'routeFadeSlideOut 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards', - '@keyframes': { - routeFadeSlideOut: { - from: { - opacity: 1, - transform: 'translateX(0)', - }, - to: { - opacity: 0, - transform: 'translateX(-12px)', - }, - }, - }, + animation: `${routeFadeSlideOut} 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards`, }); interface RouteTransitionProps { diff --git a/src/app/components/direct-list/DirectList.tsx b/src/app/components/direct-list/DirectList.tsx index a28a9db0..381c5cc7 100644 --- a/src/app/components/direct-list/DirectList.tsx +++ b/src/app/components/direct-list/DirectList.tsx @@ -192,7 +192,7 @@ const DEFAULT_CATEGORY_ID = makeNavCategoryId('direct', 'direct'); * Props for the DirectList component */ export type DirectListProps = { - scrollRef: React.RefObject; + scrollRef: React.RefObject; showCreateButton?: boolean; showCategoryHeader?: boolean; }; diff --git a/src/app/components/emoji-board/EmojiBoard.tsx b/src/app/components/emoji-board/EmojiBoard.tsx index 12b43d80..691b0995 100644 --- a/src/app/components/emoji-board/EmojiBoard.tsx +++ b/src/app/components/emoji-board/EmojiBoard.tsx @@ -296,7 +296,7 @@ function StickerSidebar({ activeGroupAtom, packs, onScrollToGroup }: StickerSide } type EmojiGroupHolderProps = { - contentScrollRef: RefObject; + contentScrollRef: RefObject; previewAtom: PrimitiveAtom; children?: ReactNode; onGroupItemClick: MouseEventHandler; diff --git a/src/app/components/image-pack-view/ImagePackContent.tsx b/src/app/components/image-pack-view/ImagePackContent.tsx index b26b2219..25d4e2f2 100644 --- a/src/app/components/image-pack-view/ImagePackContent.tsx +++ b/src/app/components/image-pack-view/ImagePackContent.tsx @@ -121,6 +121,7 @@ export const ImagePackContent = as<'div', ImagePackContentProps>( url: data.mxc, info: getImageInfo(imgEl, data.file), }; + if (!data.file.name) return; const image = PackImageReader.fromPackImage( getFileNameWithoutExt(data.file.name), packImage, diff --git a/src/app/components/scroll-top-container/ScrollTopContainer.tsx b/src/app/components/scroll-top-container/ScrollTopContainer.tsx index b68fa672..15467f66 100644 --- a/src/app/components/scroll-top-container/ScrollTopContainer.tsx +++ b/src/app/components/scroll-top-container/ScrollTopContainer.tsx @@ -10,8 +10,8 @@ import { export const ScrollTopContainer = as< 'div', { - scrollRef?: RefObject; - anchorRef: RefObject; + scrollRef?: RefObject; + anchorRef: RefObject; onVisibilityChange?: (onTop: boolean) => void; } >(({ className, scrollRef, anchorRef, onVisibilityChange, ...props }, ref) => { diff --git a/src/app/components/title-bar/TitleBar.css.ts b/src/app/components/title-bar/TitleBar.css.ts index 60af7d42..0216340a 100644 --- a/src/app/components/title-bar/TitleBar.css.ts +++ b/src/app/components/title-bar/TitleBar.css.ts @@ -1,5 +1,6 @@ import { style, keyframes } from '@vanilla-extract/css'; import { color, config } from 'folds'; +import { AppRegionStyleRule } from '../../../types/utils'; const wipeIn = keyframes({ '0%': { @@ -23,7 +24,7 @@ const wipeOut = keyframes({ }, }); -export const NewMessagePill = style({ +const newMessagePill: AppRegionStyleRule = { display: 'flex', alignItems: 'center', gap: config.space.S100, @@ -45,7 +46,9 @@ export const NewMessagePill = style({ backgroundColor: '#388E3C', }, }, -}); +}; + +export const NewMessagePill = style(newMessagePill); export const NewMessagePillExiting = style({ animation: `${wipeOut} 0.2s ease-in forwards`, @@ -65,7 +68,7 @@ export const TitleBar = style({ WebkitUserSelect: 'none', }); -export const TitleBarDragRegion = style({ +const titleBarDragRegion: AppRegionStyleRule = { display: 'flex', alignItems: 'center', height: '100%', @@ -74,14 +77,18 @@ export const TitleBarDragRegion = style({ cursor: 'default', WebkitAppRegion: 'drag', color: color.Surface.OnContainer, -}); +}; -export const TitleBarBackButton = style({ +export const TitleBarDragRegion = style(titleBarDragRegion); + +const titleBarBackButton: AppRegionStyleRule = { WebkitAppRegion: 'no-drag', flexShrink: 0, -}); +}; -export const SyncStatusBadge = style({ +export const TitleBarBackButton = style(titleBarBackButton); + +const syncStatusBadge: AppRegionStyleRule = { position: 'absolute', left: '50%', top: '50%', @@ -94,7 +101,9 @@ export const SyncStatusBadge = style({ zIndex: 1001, pointerEvents: 'none', WebkitAppRegion: 'no-drag', -}); +}; + +export const SyncStatusBadge = style(syncStatusBadge); export const SyncStatusSuccess = style({ backgroundColor: color.Success.Container, diff --git a/src/app/components/title-bar/TitleBar.tsx b/src/app/components/title-bar/TitleBar.tsx index 3dea5601..edc93306 100644 --- a/src/app/components/title-bar/TitleBar.tsx +++ b/src/app/components/title-bar/TitleBar.tsx @@ -49,7 +49,7 @@ export function TitleBar({ mx, children }: TitleBarProps) { const roomId = useAtomValue(activeRoomIdAtom); const [notifications, setNotifications] = useState([]); const dismissTimersRef = useRef>>(new Map()); - const lastMxRef = useRef(); + const lastMxRef = useRef(undefined); const navigate = useNavigate(); const roomToParents = useAtomValue(roomToParentsAtom); const mDirects = useAtomValue(mDirectAtom); diff --git a/src/app/components/update-notification/UpdateNotification.css.ts b/src/app/components/update-notification/UpdateNotification.css.ts index 9727523a..500bfb10 100644 --- a/src/app/components/update-notification/UpdateNotification.css.ts +++ b/src/app/components/update-notification/UpdateNotification.css.ts @@ -1,19 +1,22 @@ import { keyframes, style } from '@vanilla-extract/css'; import { color, config, toRem } from 'folds'; +import { AppRegionStyleRule } from '../../../types/utils'; const indeterminate = keyframes({ '0%': { transform: 'translateX(-100%)' }, '100%': { transform: 'translateX(250%)' }, }); -export const IdleSlot = style({ +const idleSlot: AppRegionStyleRule = { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%', WebkitAppRegion: 'no-drag', flexShrink: 0, -}); +}; + +export const IdleSlot = style(idleSlot); export const GhostCheck = style({ all: 'unset', @@ -38,7 +41,7 @@ export const GhostCheck = style({ }, }); -export const Bar = style({ +const bar: AppRegionStyleRule = { display: 'flex', alignItems: 'center', gap: config.space.S200, @@ -52,7 +55,9 @@ export const Bar = style({ WebkitAppRegion: 'no-drag', flexShrink: 0, boxSizing: 'border-box', -}); +}; + +export const Bar = style(bar); export const BarTrack = style({ position: 'relative', @@ -92,7 +97,7 @@ export const BarLabel = style({ textAlign: 'right', }); -export const Chip = style({ +const chip: AppRegionStyleRule = { height: toRem(22), maxWidth: toRem(260), padding: `0 ${config.space.S100} 0 ${config.space.S200}`, @@ -102,7 +107,9 @@ export const Chip = style({ WebkitAppRegion: 'no-drag', flexShrink: 0, boxSizing: 'border-box', -}); +}; + +export const Chip = style(chip); export const ChipText = style({ maxWidth: toRem(140), diff --git a/src/app/features/forum/ForumPostUploadField.tsx b/src/app/features/forum/ForumPostUploadField.tsx index 7bfeaf3f..33c53b7a 100644 --- a/src/app/features/forum/ForumPostUploadField.tsx +++ b/src/app/features/forum/ForumPostUploadField.tsx @@ -7,8 +7,8 @@ import { useMatrixClient } from '../../hooks/useMatrixClient'; import { useFilePicker } from '../../hooks/useFilePicker'; import { safeFile } from '../../utils/mimeTypes'; import { fulfilledPromiseSettledResult } from '../../utils/common'; +import { TUploadContent } from '../../utils/matrix'; import { - TUploadContent, TUploadItem, TUploadMetadata, roomIdToUploadItemsAtomFamily, @@ -199,7 +199,7 @@ export function ForumPostUploadField({ export function useForumPostUploads(roomId: string) { const mx = useMatrixClient(); const [selectedFiles, setSelectedFiles] = useAtom(roomIdToUploadItemsAtomFamily(roomId)); - const uploadBoardHandlers = useRef(); + const uploadBoardHandlers = useRef(undefined); const uploadResolverRef = useRef<{ resolve: (contents: IContent[]) => void; reject: (err: unknown) => void; diff --git a/src/app/features/forum/ForumReplyComposer.tsx b/src/app/features/forum/ForumReplyComposer.tsx index 0ba9bf4a..046a6535 100644 --- a/src/app/features/forum/ForumReplyComposer.tsx +++ b/src/app/features/forum/ForumReplyComposer.tsx @@ -13,7 +13,7 @@ type ForumReplyComposerProps = { roomId: string; threadRootId: string; replyToEventId: string; - fileDropContainerRef: RefObject; + fileDropContainerRef: RefObject; onSent?: () => void; onCancel?: () => void; }; diff --git a/src/app/features/forum/ForumThreadDetail.tsx b/src/app/features/forum/ForumThreadDetail.tsx index cdc0f315..110dad59 100644 --- a/src/app/features/forum/ForumThreadDetail.tsx +++ b/src/app/features/forum/ForumThreadDetail.tsx @@ -124,7 +124,7 @@ type ForumThreadMessageProps = { room: Room; roomId: string; threadRootId: string; - fileDropContainerRef: RefObject; + fileDropContainerRef: RefObject; editEventId?: string; onEditEventId: (eventId?: string) => void; onComposerSent: () => void; @@ -303,7 +303,7 @@ type ForumThreadDetailProps = { rootEventId: string; titleHint?: string; initialPost?: ForumPost | null; - fileDropContainerRef?: RefObject; + fileDropContainerRef?: RefObject; onReplySent?: (reply: ForumPost) => void; }; diff --git a/src/app/features/lobby/DnD.tsx b/src/app/features/lobby/DnD.tsx index b7e2a48f..a678620f 100644 --- a/src/app/features/lobby/DnD.tsx +++ b/src/app/features/lobby/DnD.tsx @@ -20,9 +20,9 @@ export type CanDropCallback = (item: HierarchyItem, container: DropContainerData export const useDraggableItem = ( item: HierarchyItem, - targetRef: RefObject, + targetRef: RefObject, onDragging: (item?: HierarchyItem) => void, - dragHandleRef?: RefObject, + dragHandleRef?: RefObject, ): boolean => { const [dragging, setDragging] = useState(false); @@ -120,7 +120,7 @@ export function AfterItemDropTarget({ } export const useDnDMonitor = ( - scrollRef: RefObject, + scrollRef: RefObject, onDragging: (item?: HierarchyItem) => void, onReorder: (item: HierarchyItem, container: DropContainerData) => void, ) => { diff --git a/src/app/features/message-search/MessageSearch.tsx b/src/app/features/message-search/MessageSearch.tsx index fec49546..00df4b5c 100644 --- a/src/app/features/message-search/MessageSearch.tsx +++ b/src/app/features/message-search/MessageSearch.tsx @@ -42,7 +42,7 @@ type MessageSearchProps = { allowGlobal?: boolean; rooms: string[]; senders?: string[]; - scrollRef: RefObject; + scrollRef: RefObject; }; export function MessageSearch({ defaultRoomsFilterName, diff --git a/src/app/features/message-search/SearchInput.tsx b/src/app/features/message-search/SearchInput.tsx index f03eba12..2aa4fbd4 100644 --- a/src/app/features/message-search/SearchInput.tsx +++ b/src/app/features/message-search/SearchInput.tsx @@ -6,7 +6,7 @@ import { Icon, Icons } from '../../components/icons'; type SearchProps = { active?: boolean; loading?: boolean; - searchInputRef: RefObject; + searchInputRef: RefObject; onSearch: (term: string) => void; onReset: () => void; }; diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx index 949b78bd..0df65f07 100644 --- a/src/app/features/room/RoomInput.tsx +++ b/src/app/features/room/RoomInput.tsx @@ -130,7 +130,7 @@ const createCarouselUuid = (): string => { interface RoomInputProps { editor: Editor; - fileDropContainerRef: RefObject; + fileDropContainerRef: RefObject; roomId: string; room: Room; /** When provided, all messages are sent as replies in this thread. */ @@ -207,7 +207,7 @@ export const RoomInput = forwardRef( roomUploadAtomFamily, selectedFiles.map((f) => f.file), ); - const uploadBoardHandlers = useRef(); + const uploadBoardHandlers = useRef(undefined); const editorRef = useRef(null); const imagePackRooms: Room[] = useImagePackRooms(roomId, roomToParents); diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index e4650905..2302add0 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -373,7 +373,7 @@ export const getEventIdAbsoluteIndex = ( type RoomTimelineProps = { room: Room; eventId?: string; - roomInputRef: RefObject; + roomInputRef: RefObject; editor: Editor; }; @@ -665,7 +665,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli const [unreadInfo, setUnreadInfo] = useState(() => getRoomUnreadInfo(room, scrollToLatestBehavior !== ScrollToLatestBehavior.Always), ); - const readUptoEventIdRef = useRef(); + const readUptoEventIdRef = useRef(undefined); if (unreadInfo) { readUptoEventIdRef.current = unreadInfo.readUptoEventId; } diff --git a/src/app/features/search/Search.tsx b/src/app/features/search/Search.tsx index 85e51432..cd1bdd5b 100644 --- a/src/app/features/search/Search.tsx +++ b/src/app/features/search/Search.tsx @@ -262,7 +262,7 @@ export function Search({ requestClose }: SearchProps) { allowOutsideClick: true, clickOutsideDeactivates: true, onDeactivate: requestClose, - escapeDeactivates: (evt) => { + escapeDeactivates: (evt: KeyboardEvent) => { evt.stopPropagation(); return true; }, diff --git a/src/app/hooks/useDebounce.ts b/src/app/hooks/useDebounce.ts index df48f3d2..0a9f071e 100644 --- a/src/app/hooks/useDebounce.ts +++ b/src/app/hooks/useDebounce.ts @@ -10,7 +10,7 @@ export function useDebounce( callback: DebounceCallback, options?: DebounceOptions, ): DebounceCallback { - const timeoutIdRef = useRef(); + const timeoutIdRef = useRef(undefined); const { wait, immediate } = options ?? {}; const debounceCallback = useCallback( diff --git a/src/app/hooks/useFileDrop.ts b/src/app/hooks/useFileDrop.ts index c6c46a8a..32b653e3 100644 --- a/src/app/hooks/useFileDrop.ts +++ b/src/app/hooks/useFileDrop.ts @@ -11,10 +11,10 @@ export const useFileDropHandler = (onDrop: (file: File[]) => void): DragEventHan ); export const useFileDropZone = ( - zoneRef: RefObject | undefined, + zoneRef: RefObject | undefined, onDrop: (file: File[]) => void, ): boolean => { - const dragStateRef = useRef<'start' | 'leave' | 'over'>(); + const dragStateRef = useRef<'start' | 'leave' | 'over' | undefined>(undefined); const [active, setActive] = useState(false); useEffect(() => { diff --git a/src/app/hooks/useInertialHorizontalScroll.ts b/src/app/hooks/useInertialHorizontalScroll.ts index 9935b4bc..ab47d07e 100644 --- a/src/app/hooks/useInertialHorizontalScroll.ts +++ b/src/app/hooks/useInertialHorizontalScroll.ts @@ -14,7 +14,7 @@ export type UseInertialHorizontalScrollOptions = { }; export type UseInertialHorizontalScrollResult = { - scrollRef: RefObject; + scrollRef: RefObject; isDragging: boolean; canScrollBack: boolean; canScrollForward: boolean; diff --git a/src/app/hooks/useThrottle.ts b/src/app/hooks/useThrottle.ts index fd5a878f..d09a7995 100644 --- a/src/app/hooks/useThrottle.ts +++ b/src/app/hooks/useThrottle.ts @@ -11,8 +11,8 @@ export function useThrottle( callback: ThrottleCallback, options?: ThrottleOptions, ): ThrottleCallback { - const timeoutIdRef = useRef(); - const argsRef = useRef(); + const timeoutIdRef = useRef(undefined); + const argsRef = useRef(undefined); const { wait, immediate } = options ?? {}; const debounceCallback = useCallback( diff --git a/src/app/hooks/useVirtualPaginator.ts b/src/app/hooks/useVirtualPaginator.ts index c533ed26..52385bce 100644 --- a/src/app/hooks/useVirtualPaginator.ts +++ b/src/app/hooks/useVirtualPaginator.ts @@ -167,16 +167,22 @@ export const useVirtualPaginator = ( const initialRenderRef = useRef(true); - const restoreScrollRef = useRef<{ - scrollTop: number; - anchorOffsetTop: number; - anchorItem: number; - }>(); + const restoreScrollRef = useRef< + | { + scrollTop: number; + anchorOffsetTop: number; + anchorItem: number; + } + | undefined + >(undefined); - const scrollToItemRef = useRef<{ - index: number; - opts?: ScrollToOptions; - }>(); + const scrollToItemRef = useRef< + | { + index: number; + opts?: ScrollToOptions; + } + | undefined + >(undefined); const propRef = useRef({ range, diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx index 46f99fe7..0bb7d609 100644 --- a/src/app/pages/client/ClientNonUIFeatures.tsx +++ b/src/app/pages/client/ClientNonUIFeatures.tsx @@ -216,7 +216,7 @@ function InviteNotifications() { } function MessageNotifications() { - const notifRef = useRef(); + const notifRef = useRef(undefined); const unreadCacheRef = useRef>(new Map()); const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); diff --git a/src/app/pages/client/explore/Server.tsx b/src/app/pages/client/explore/Server.tsx index e9c15a06..cab2292f 100644 --- a/src/app/pages/client/explore/Server.tsx +++ b/src/app/pages/client/explore/Server.tsx @@ -85,7 +85,7 @@ const FALLBACK_ROOMS_LIMIT = 24; type SearchProps = { active?: boolean; loading?: boolean; - searchInputRef: RefObject; + searchInputRef: RefObject; onSearch: (term: string) => void; onReset: () => void; }; diff --git a/src/app/pages/client/sidebar/SpaceTabs.tsx b/src/app/pages/client/sidebar/SpaceTabs.tsx index d61a4a97..709e336d 100644 --- a/src/app/pages/client/sidebar/SpaceTabs.tsx +++ b/src/app/pages/client/sidebar/SpaceTabs.tsx @@ -299,9 +299,9 @@ type SidebarDraggable = string | FolderDraggable; const useDraggableItem = ( item: SidebarDraggable, - targetRef: RefObject, + targetRef: RefObject, onDragging: (item?: SidebarDraggable) => void, - dragHandleRef?: RefObject, + dragHandleRef?: RefObject, ): boolean => { const [dragging, setDragging] = useState(false); @@ -331,7 +331,7 @@ const useDraggableItem = ( const useDropTarget = ( item: SidebarDraggable, - targetRef: RefObject, + targetRef: RefObject, ): Instruction | undefined => { const [dropState, setDropState] = useState(); @@ -379,7 +379,7 @@ const useDropTarget = ( function useDropTargetInstruction( item: SidebarDraggable, - targetRef: RefObject, + targetRef: RefObject, instructionType: T, ): T | undefined { const [dropState, setDropState] = useState(); @@ -411,7 +411,7 @@ function useDropTargetInstruction( } const useDnDMonitor = ( - scrollRef: RefObject, + scrollRef: RefObject, onDragging: (dragItem?: SidebarDraggable) => void, onReorder: ( draggable: SidebarDraggable, @@ -911,7 +911,7 @@ function HiddenSpacesFolder({ } type SpaceTabsProps = { - scrollRef: RefObject; + scrollRef: RefObject; }; export function SpaceTabs({ scrollRef }: SpaceTabsProps) { const navigate = useNavigateWithTransition(); diff --git a/src/app/utils/backgroundSync.ts b/src/app/utils/backgroundSync.ts index 9a28096b..84a68b42 100644 --- a/src/app/utils/backgroundSync.ts +++ b/src/app/utils/backgroundSync.ts @@ -382,17 +382,26 @@ class AndroidUnifiedPushManager { const MatrixBackgroundSync = registerPlugin('MatrixBackgroundSync'); this.listenerHandles = [ - await MatrixBackgroundSync.addListener('unifiedPushNewEndpoint', (event) => { - this.handleNewEndpoint(event).catch((err) => { - console.error('[BackgroundSync] handleNewEndpoint failed:', err); - }); - }), - await MatrixBackgroundSync.addListener('unifiedPushUnregistered', (event) => { - this.handleUnregistered(event); - }), - await MatrixBackgroundSync.addListener('unifiedPushRegistrationFailed', (event) => { - this.handleRegistrationFailed(event); - }), + await MatrixBackgroundSync.addListener( + 'unifiedPushNewEndpoint', + (event: UnifiedPushEndpointEvent) => { + this.handleNewEndpoint(event).catch((err) => { + console.error('[BackgroundSync] handleNewEndpoint failed:', err); + }); + }, + ), + await MatrixBackgroundSync.addListener( + 'unifiedPushUnregistered', + (event: UnifiedPushUnregisteredEvent) => { + this.handleUnregistered(event); + }, + ), + await MatrixBackgroundSync.addListener( + 'unifiedPushRegistrationFailed', + (event: UnifiedPushRegistrationFailedEvent) => { + this.handleRegistrationFailed(event); + }, + ), ]; this.listenersReady = true; } diff --git a/src/app/utils/copyHandler.ts b/src/app/utils/copyHandler.ts index 1071e4ba..72c33e10 100644 --- a/src/app/utils/copyHandler.ts +++ b/src/app/utils/copyHandler.ts @@ -7,7 +7,7 @@ import { timeHourMinute } from './time'; * This intercepts the copy event on the timeline and reformats the copied text. */ export const setupCopyHandler = ( - containerRef: React.RefObject, + containerRef: React.RefObject, getMessageData: (eventId: string) => { sender: string; ts: number; content: string } | null, hour24Clock: boolean, ): (() => void) => { diff --git a/src/app/utils/matrix.ts b/src/app/utils/matrix.ts index 9121eb4e..64b625aa 100644 --- a/src/app/utils/matrix.ts +++ b/src/app/utils/matrix.ts @@ -133,7 +133,8 @@ export const decryptFile = async ( return blob; }; -export type TUploadContent = File | Blob; +// Producers can pass a plain Blob (decryptFile), so name is not always present. +export type TUploadContent = File | (Blob & { name?: string }); export type ContentUploadOptions = { name?: string; diff --git a/src/types/utils.ts b/src/types/utils.ts index 353ace6e..2c1aa212 100644 --- a/src/types/utils.ts +++ b/src/types/utils.ts @@ -1,3 +1,8 @@ +import { ComplexStyleRule } from '@vanilla-extract/css'; + export type WithRequiredProp = Type & { [Property in Key]-?: Type[Property]; }; + +// csstype has no WebkitAppRegion, and ComplexStyleRule is a type alias, so it can only be intersected. +export type AppRegionStyleRule = ComplexStyleRule & { WebkitAppRegion?: 'drag' | 'no-drag' };