Apply strictNullChecks
to src/contexts/*
(#10490)
This commit is contained in:
parent
17b456c7ee
commit
212977c4ac
4 changed files with 6 additions and 5 deletions
|
@ -46,7 +46,8 @@ export function useEditing(
|
||||||
);
|
);
|
||||||
|
|
||||||
const editMessageMemoized = useCallback(
|
const editMessageMemoized = useCallback(
|
||||||
() => content !== undefined && editMessage(content, { roomContext, mxClient, editorStateTransfer }),
|
() =>
|
||||||
|
!!mxClient && content !== undefined && editMessage(content, { roomContext, mxClient, editorStateTransfer }),
|
||||||
[content, roomContext, mxClient, editorStateTransfer],
|
[content, roomContext, mxClient, editorStateTransfer],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ export function useInitialContent(editorStateTransfer: EditorStateTransfer): str
|
||||||
const mxClient = useMatrixClientContext();
|
const mxClient = useMatrixClientContext();
|
||||||
|
|
||||||
return useMemo<string | undefined>(() => {
|
return useMemo<string | undefined>(() => {
|
||||||
if (editorStateTransfer && roomContext.room) {
|
if (editorStateTransfer && roomContext.room && mxClient) {
|
||||||
return parseEditorStateTransfer(editorStateTransfer, roomContext.room, mxClient);
|
return parseEditorStateTransfer(editorStateTransfer, roomContext.room, mxClient);
|
||||||
}
|
}
|
||||||
}, [editorStateTransfer, roomContext, mxClient]);
|
}, [editorStateTransfer, roomContext, mxClient]);
|
||||||
|
|
|
@ -25,7 +25,7 @@ import React, {
|
||||||
} from "react";
|
} from "react";
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
|
|
||||||
const MatrixClientContext = createContext<MatrixClient>(undefined);
|
const MatrixClientContext = createContext<MatrixClient | undefined>(undefined);
|
||||||
MatrixClientContext.displayName = "MatrixClientContext";
|
MatrixClientContext.displayName = "MatrixClientContext";
|
||||||
export default MatrixClientContext;
|
export default MatrixClientContext;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ export interface MatrixClientProps {
|
||||||
mxClient: MatrixClient;
|
mxClient: MatrixClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useMatrixClientContext(): MatrixClient {
|
export function useMatrixClientContext(): MatrixClient | undefined {
|
||||||
return useContext(MatrixClientContext);
|
return useContext(MatrixClientContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ import {
|
||||||
VoiceBroadcastRecordingsStore,
|
VoiceBroadcastRecordingsStore,
|
||||||
} from "../voice-broadcast";
|
} from "../voice-broadcast";
|
||||||
|
|
||||||
export const SDKContext = createContext<SdkContextClass>(undefined);
|
export const SDKContext = createContext<SdkContextClass | undefined>(undefined);
|
||||||
SDKContext.displayName = "SDKContext";
|
SDKContext.displayName = "SDKContext";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue