Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .changeset/implements_improved_subspace_rendering.md

This file was deleted.

30 changes: 2 additions & 28 deletions src/app/features/add-existing/AddExisting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,39 +83,13 @@ export function AddExistingModal({ parentId, space, requestClose }: AddExistingM
const allRoomsSet = useAllJoinedRoomsSet();
const getRoom = useGetRoom(allRoomsSet);

/**
* Recursively checks if a given sourceId room is an ancestor to the targetId space.
*
* @param sourceId - The room to check.
* @param targetId - The space ID to check against.
* @param visited - Set used to prevent recursion errors.
* @returns True if rId is an ancestor of targetId.
*/
const isAncestor = useCallback(
(sourceId: string, targetId: string, visited: Set<string> = new Set()): boolean => {
// Prevent infinite recursion
if (visited.has(targetId)) return false;
visited.add(targetId);

const parentIds = roomIdToParents.get(targetId);
if (!parentIds) return false;

if (parentIds.has(sourceId)) {
return true;
}

return Array.from(parentIds).some((id) => isAncestor(sourceId, id, visited));
},
[roomIdToParents]
);

const allItems: string[] = useMemo(() => {
const rIds = space ? [...spaces] : [...rooms, ...directs];

return rIds
.filter((rId) => rId !== parentId && !isAncestor(rId, parentId))
.filter((rId) => rId !== parentId && !roomIdToParents.get(rId)?.has(parentId))
.sort(factoryRoomIdByAtoZ(mx));
}, [space, spaces, rooms, directs, mx, parentId, isAncestor]);
}, [spaces, rooms, directs, space, parentId, roomIdToParents, mx]);

const getRoomNameStr: SearchItemStrGetter<string> = useCallback(
(rId) => getRoom(rId)?.name ?? rId,
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/lobby/DnD.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ItemDraggableTarget = style([
top: 0,
zIndex: 1,
cursor: 'grab',
borderRadius: 0,
borderRadius: config.radii.R400,
opacity: config.opacity.P300,

':active': {
Expand Down
15 changes: 0 additions & 15 deletions src/app/features/lobby/HierarchyItemMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import { IPowerLevels } from '$hooks/usePowerLevels';
import { getRoomCreatorsForRoomId } from '$hooks/useRoomCreators';
import { getRoomPermissionsAPI } from '$hooks/useRoomPermissions';
import { InviteUserPrompt } from '$components/invite-user-prompt';
import { getCanonicalAliasOrRoomId } from '$utils/matrix';
import { useNavigate } from 'react-router-dom';
import { getSpaceLobbyPath } from '$pages/pathUtils';

type HierarchyItemWithParent = HierarchyItem & {
parentId: string;
Expand Down Expand Up @@ -230,7 +227,6 @@ export function HierarchyItemMenu({
};

const handleRequestClose = useCallback(() => setMenuAnchor(undefined), []);
const navigate = useNavigate();

if (!joined && !canEditChild) {
return null;
Expand Down Expand Up @@ -282,17 +278,6 @@ export function HierarchyItemMenu({
</Text>
</MenuItem>
)}
<MenuItem
size="300"
radii="300"
onClick={() => {
navigate(getSpaceLobbyPath(getCanonicalAliasOrRoomId(mx, item.roomId)));
}}
>
<Text as="span" size="T300" truncate>
Open Lobby
</Text>
</MenuItem>
<InviteMenuItem
item={item}
requestClose={handleRequestClose}
Expand Down
Loading
Loading