Files
cinny/src/app/hooks/useAccountData.ts
T
jaredandClaude Opus 4.8 85ac8de5d9 style: apply prettier across fork files
check:prettier was not part of my gate routine, so formatting drift accumulated
across the session's touched files (and a few older ones). Run prettier --write
to bring the repo back to 'All matched files use Prettier code style!'.
Formatting only — no logic changes. tsc/tests/build all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 13:52:36 -04:00

25 lines
686 B
TypeScript

import { MatrixEvent } from 'matrix-js-sdk';
import { useState, useCallback } from 'react';
import { useMatrixClient } from './useMatrixClient';
import { useAccountDataCallback } from './useAccountDataCallback';
import { getAccountData } from '../utils/room';
export function useAccountData(eventType: string): MatrixEvent | undefined {
const mx = useMatrixClient();
const [event, setEvent] = useState<MatrixEvent | undefined>(() => getAccountData(mx, eventType));
useAccountDataCallback(
mx,
useCallback(
(evt) => {
if (evt.getType() === eventType) {
setEvent(evt);
}
},
[eventType, setEvent],
),
);
return event;
}