Files
Sable/src/app/hooks/useMatrixClient.ts
T
hazre 71425f8644 refactor: route matrix-sdk imports through $types boundary
Centralize Matrix SDK imports behind a local compatibility module, migrate matrix subpath imports to the boundary, and switch to the $types alias. Upgrade TypeScript to latest so matrix-js-sdk typings resolve correctly before the next cleanup phase.
2026-02-14 17:24:46 +01:00

13 lines
412 B
TypeScript

import { createContext, useContext } from 'react';
import { MatrixClient } from '$types/matrix-sdk';
const MatrixClientContext = createContext<MatrixClient | null>(null);
export const MatrixClientProvider = MatrixClientContext.Provider;
export function useMatrixClient(): MatrixClient {
const mx = useContext(MatrixClientContext);
if (!mx) throw new Error('MatrixClient not initialized!');
return mx;
}