Add a type

This commit is contained in:
Eric Bailey
2026-06-09 14:45:27 -05:00
committed by Samuel Newman
parent d3b0452401
commit fef1bad264
+6 -2
View File
@@ -53,8 +53,9 @@ const shadows: WeakMap<
> = new WeakMap() > = new WeakMap()
const emitter = new EventEmitter() const emitter = new EventEmitter()
type ShadowUpdateEventPayload = {did: string; shadow: Partial<ProfileShadow>}
export function useOnUpdateProfileShadow( export function useOnUpdateProfileShadow(
onUpdate: (props: {did: string; shadow: Partial<ProfileShadow>}) => void, onUpdate: (payload: ShadowUpdateEventPayload) => void,
) { ) {
useEffect(() => { useEffect(() => {
emitter.addListener('shadow-update', onUpdate) emitter.addListener('shadow-update', onUpdate)
@@ -217,7 +218,10 @@ export function updateProfileShadow(
} }
batchedUpdates(() => { batchedUpdates(() => {
emitter.emit(did, value) emitter.emit(did, value)
emitter.emit('shadow-update', {did, shadow: value}) emitter.emit('shadow-update', {
did,
shadow: value,
} satisfies ShadowUpdateEventPayload)
}) })
} }