Skip to content

Commit

Permalink
Return null when computed
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Nov 12, 2024
1 parent 639de21 commit c76f086
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks/useIsEncrypted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { MatrixClient, MatrixEvent, Room, RoomStateEvent, EventType } from "matr

import { useTypedEventEmitter } from "./useEventEmitter";

// Hook to simplify watching whether a Matrix room is encrypted, returns undefined if room is undefined or when isRoomEncrypted is computed
export function useIsEncrypted(cli: MatrixClient, room?: Room): boolean | undefined {
const [isEncrypted, setIsEncrypted] = useState<boolean>();
// Hook to simplify watching whether a Matrix room is encrypted, returns undefined if room is undefined, return null when isRoomEncrypted is computed
export function useIsEncrypted(cli: MatrixClient, room?: Room): boolean | undefined | null {
const [isEncrypted, setIsEncrypted] = useState<boolean | null | undefined>(null);

useEffect(() => {
const func = async (): Promise<void> =>
Expand Down

0 comments on commit c76f086

Please sign in to comment.