Augment the custom event types and make the dep arrays honest. [skip build]
This commit is contained in:
@@ -56,7 +56,7 @@ function CreatePackTile({ packs, roomId }: CreatePackTileProps) {
|
||||
display_name: name,
|
||||
},
|
||||
};
|
||||
await mx.sendStateEvent(roomId, StateEvent.PoniesRoomEmotes as any, content, stateKey);
|
||||
await mx.sendStateEvent(roomId, StateEvent.PoniesRoomEmotes, content, stateKey);
|
||||
},
|
||||
[mx, roomId],
|
||||
),
|
||||
@@ -162,7 +162,7 @@ export function RoomPacks({ onViewPack }: RoomPacksProps) {
|
||||
useCallback(async () => {
|
||||
for (let i = 0; i < removedPacks.length; i += 1) {
|
||||
const addr = removedPacks[i];
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.PoniesRoomEmotes as any, {}, addr.stateKey);
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.PoniesRoomEmotes, {}, addr.stateKey);
|
||||
}
|
||||
}, [mx, room, removedPacks]),
|
||||
);
|
||||
|
||||
@@ -332,7 +332,7 @@ export function PowersEditor({ powerLevels, requestClose }: PowersEditorProps) {
|
||||
deleted.forEach((power) => {
|
||||
delete content[power];
|
||||
});
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.PowerLevelTags as any, content);
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.PowerLevelTags, content);
|
||||
}, [mx, room, powerLevelTags, editedPowerTags, deleted]),
|
||||
);
|
||||
|
||||
|
||||
@@ -348,7 +348,6 @@ function ForumThreadDetailBody({
|
||||
setReplyToEventId(rootEventId);
|
||||
}
|
||||
}, [replyDraft, rootEventId]);
|
||||
const [contentRevision, setContentRevision] = useState(0);
|
||||
const [collapsedBranches, setCollapsedBranches] = useState<Set<string>>(() => new Set());
|
||||
const localDropRef = useRef<HTMLDivElement>(null);
|
||||
const dropRef = fileDropContainerRef ?? localDropRef;
|
||||
@@ -393,14 +392,8 @@ function ForumThreadDetailBody({
|
||||
handleComposerSent();
|
||||
}, [handleComposerSent]);
|
||||
|
||||
useForumRoomLiveUpdates(
|
||||
[room],
|
||||
() => {
|
||||
setContentRevision((revision) => revision + 1);
|
||||
reloadThread();
|
||||
},
|
||||
{ threadRootId: rootEventId, wait: 150 },
|
||||
);
|
||||
// post is the reactive source: reloadThread pushes the local thread back through onPostUpdate
|
||||
useForumRoomLiveUpdates([room], reloadThread, { threadRootId: rootEventId, wait: 150 });
|
||||
|
||||
const rootEvent = room.findEventById(rootEventId);
|
||||
const rootEditing = editEventId === rootEventId;
|
||||
@@ -424,7 +417,6 @@ function ForumThreadDetailBody({
|
||||
|
||||
const handleEditRootClose = useCallback(() => {
|
||||
setEditEventId(undefined);
|
||||
setContentRevision((revision) => revision + 1);
|
||||
handleComposerSent();
|
||||
}, [handleComposerSent]);
|
||||
|
||||
@@ -476,7 +468,7 @@ function ForumThreadDetailBody({
|
||||
const title = useMemo(() => {
|
||||
const local = loadPostThreadLocal(mx, roomId, rootEventId);
|
||||
return local?.title || post.title || titleHint || '(untitled post)';
|
||||
}, [contentRevision, mx, post.title, roomId, rootEventId, titleHint]);
|
||||
}, [mx, post.title, roomId, rootEventId, titleHint]);
|
||||
|
||||
return (
|
||||
<article ref={localDropRef} className={theme.ForumTopicDetailRoot} data-event-id={post.eventId}>
|
||||
|
||||
@@ -79,8 +79,7 @@ export function useForumMessageReactions(room: Room, mEvent: MatrixEvent | undef
|
||||
const reactionRelations = useMemo(() => {
|
||||
if (!eventId) return undefined;
|
||||
return getEventReactions(roomTimelineSet, eventId);
|
||||
// relationsRevision forces re-read after timeline / relation updates
|
||||
}, [eventId, relationsRevision, roomTimelineSet]);
|
||||
}, [eventId, roomTimelineSet]);
|
||||
|
||||
const hasReactions = Boolean(reactionRelations?.getSortedAnnotationsByKey()?.length);
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ function SpaceCardLobby() {
|
||||
newItems.push(rId);
|
||||
}
|
||||
const newSpacesContent = makeCinnySpacesContent(mx, newItems);
|
||||
mx.setAccountData(AccountDataEvent.CinnySpaces as any, newSpacesContent as any);
|
||||
mx.setAccountData(AccountDataEvent.CinnySpaces, newSpacesContent);
|
||||
},
|
||||
[mx, sidebarItems, sidebarSpaces],
|
||||
);
|
||||
|
||||
@@ -107,8 +107,9 @@ export const SpaceHierarchy = forwardRef<HTMLDivElement, SpaceHierarchyProps>(
|
||||
// This ensures sub-rooms are hidden even if their parent isn't in this space
|
||||
const globalSubRoomIds = useMemo(() => {
|
||||
const subRoomIds = new Set<string>();
|
||||
mx.getRooms().forEach((room) => {
|
||||
const subRoomsEvent = room.currentState.getStateEvents(StateEvent.PaarrotSubRooms, '');
|
||||
allJoinedRooms.forEach((roomId) => {
|
||||
const room = mx.getRoom(roomId);
|
||||
const subRoomsEvent = room?.currentState.getStateEvents(StateEvent.PaarrotSubRooms, '');
|
||||
const content = subRoomsEvent?.getContent<PaarrotSubRoomsContent>();
|
||||
content?.children?.forEach((childId: string) => subRoomIds.add(childId));
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@ export function RoomAppView({ room, onShowChat }: RoomAppViewProps) {
|
||||
|
||||
const handleAction = useCallback(
|
||||
async (payload: PaarrotUiActionContent) => {
|
||||
await mx.sendEvent(room.roomId, MessageEvent.PaarrotUiAction as any, payload);
|
||||
await mx.sendEvent(room.roomId, MessageEvent.PaarrotUiAction, payload);
|
||||
},
|
||||
[mx, room.roomId],
|
||||
);
|
||||
|
||||
@@ -191,11 +191,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
||||
|
||||
// Also copy power level tags if they exist
|
||||
if (powerLevelTags) {
|
||||
await mx.sendStateEvent(
|
||||
childId,
|
||||
'in.cinny.room.power_level_tags' as any,
|
||||
powerLevelTags,
|
||||
);
|
||||
await mx.sendStateEvent(childId, StateEvent.PowerLevelTags, powerLevelTags);
|
||||
}
|
||||
|
||||
completed += 1;
|
||||
|
||||
Reference in New Issue
Block a user