Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/frontend/src/components/composer/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const Composer = forwardRef<
{
isContactRequest: boolean
selectedChat: Type.FullChat
regularMessageInputRef: React.MutableRefObject<ComposerMessageInput | null>
editMessageInputRef: React.MutableRefObject<ComposerMessageInput | null>
regularMessageInputRef: React.RefObject<ComposerMessageInput | null>
editMessageInputRef: React.RefObject<ComposerMessageInput | null>
draftState: DraftObject
onSelectReplyToShortcut: ReturnType<
typeof useDraft
Expand Down Expand Up @@ -766,7 +766,7 @@ export function useDraft(
chatId: number | null,
isContactRequest: boolean,
canSend: boolean, // no draft needed in chats we can't send messages
inputRef: React.MutableRefObject<ComposerMessageInput | null>
inputRef: React.RefObject<ComposerMessageInput | null>
): {
draftState: DraftObject
onSelectReplyToShortcut: (
Expand Down Expand Up @@ -1075,7 +1075,7 @@ export function useDraft(
function useMessageEditing(
accountId: number,
chatId: T.BasicChat['id'],
editMessageInputRef: React.MutableRefObject<ComposerMessageInput | null>
editMessageInputRef: React.RefObject<ComposerMessageInput | null>
) {
const tx = useTranslationFunction()
const { userFeedback } = useContext(ScreenContext)
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/src/components/dialogs/FullscreenAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export default function FullscreenAvatar(
const tx = useTranslationFunction()
const { onClose, imagePath } = props

const resetImageZoom = useRef<(() => void) | null>(
null
) as React.MutableRefObject<(() => void) | null>
const resetImageZoom = useRef<(() => void) | null>(null) as React.RefObject<
(() => void) | null
>

const saveAs = () => {
runtime.downloadFile(imagePath, basename(imagePath))
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/src/components/dialogs/FullscreenMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export default function FullscreenMedia(props: Props & DialogProps) {
const { onClose } = props

const [msg, setMsg] = useState(props.msg)
const resetImageZoom = useRef<(() => void) | null>(
null
) as React.MutableRefObject<(() => void) | null>
const resetImageZoom = useRef<(() => void) | null>(null) as React.RefObject<
(() => void) | null
>
const previousNextMessageId = useRef<[number | null, number | null]>([
null,
null,
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/components/helpers/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MutableRefObject, useEffect, useRef, useState } from 'react'
import { RefObject, useEffect, useRef, useState } from 'react'
import { debounce } from 'debounce'

/** debounce workaround so it can be useful in useFunctions that are used from multiple places at once
Expand Down Expand Up @@ -26,7 +26,7 @@ export function useRefLock(): {
setLock: (lock: boolean) => {
return (lockRef.current = lock)
},
}) as MutableRefObject<any>
}) as RefObject<any>

return stableRef.current
}
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/src/components/message/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {
useRef,
useCallback,
useLayoutEffect,
MutableRefObject,
RefObject,
useEffect,
useState,
useMemo,
Expand Down Expand Up @@ -219,7 +219,7 @@ export default function MessageList({ accountId, chat, refComposer }: Props) {
}
})
}
const unreadMessageInViewIntersectionObserver: MutableRefObject<IntersectionObserver> =
const unreadMessageInViewIntersectionObserver: RefObject<IntersectionObserver> =
useRef(
new IntersectionObserver(onUnreadMessageInView, {
root: null,
Expand Down Expand Up @@ -744,10 +744,10 @@ export const MessageListInner = React.memo(
messageListItems: T.MessageListItem[]
activeView: T.MessageListItem[]
messageCache: { [msgId: number]: T.MessageLoadResult | undefined }
messageListRef: React.MutableRefObject<HTMLDivElement | null>
messageListRef: React.RefObject<HTMLDivElement | null>
chat: T.FullChat
loaded: boolean
unreadMessageInViewIntersectionObserver: React.MutableRefObject<IntersectionObserver | null>
unreadMessageInViewIntersectionObserver: React.RefObject<IntersectionObserver | null>
loadMissingMessages: () => Promise<void>
}) => {
const tx = useTranslationFunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type RenderMessageProps = {
chat: T.FullChat
message: T.Message
conversationType: ConversationType
unreadMessageInViewIntersectionObserver: React.MutableRefObject<IntersectionObserver | null>
unreadMessageInViewIntersectionObserver: React.RefObject<IntersectionObserver | null>
}

const log = getLogger('renderer/message/MessageWrapper')
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/contexts/ChatContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ActionEmitter, KeybindAction } from '../keybindings'
import { markChatAsSeen, saveLastChatId } from '../backend/chat'
import { BackendRemote } from '../backend-com'

import type { MutableRefObject, PropsWithChildren } from 'react'
import type { RefObject, PropsWithChildren } from 'react'
import type { T } from '@deltachat/jsonrpc-client'
import { useRpcFetch } from '../hooks/useFetch'
import { getLogger } from '@deltachat-desktop/shared/logger'
Expand Down Expand Up @@ -63,7 +63,7 @@ type Props = {
* the ref gives us a handle to reset the component without moving it up in the hierarchy.
* a class component would give us the option to call methods on the component,
* but we are using a functional component here so we need to pass this as a property instead*/
unselectChatRef: MutableRefObject<UnselectChat | null>
unselectChatRef: RefObject<UnselectChat | null>
}

export const ChatContext = React.createContext<ChatContextValue | null>(null)
Expand Down
Loading