Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot view room from space home after upgrading #24329

Closed
Johennes opened this issue Jan 25, 2023 · 7 comments
Closed

Cannot view room from space home after upgrading #24329

Johennes opened this issue Jan 25, 2023 · 7 comments
Labels
A-Spaces Spaces, groups, communities O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@Johennes
Copy link
Contributor

Steps to reproduce

I upgraded the Element web app team room which was in the WAT space. After the room upgrade, I can see both the old and new room in the m.space.child state event. On the space home page, the room sows up (a single time) but clicking the "view" button or trying to delete it does nothing.

Outcome

What did you expect?

The buttons to work as they did before and to take me to the new room.

What happened instead?

Nothing.

Operating system

macOS

Application version

Element Desktop nightly

How did you install the app?

No response

Homeserver

No response

Will you send logs?

No

@weeman1337 weeman1337 added S-Major Severely degrades major functionality or product features, with no satisfactory workaround A-Spaces Spaces, groups, communities O-Occasional Affects or can be seen by some users regularly or most users rarely labels Jan 26, 2023
@weeman1337
Copy link
Contributor

weeman1337 commented Jan 26, 2023

Can reproduce. O-Occasional spaces are quite common. S-Major because I cannot join or view an upgraded room, that I can see in the space list.

@Johennes
Copy link
Contributor Author

Console error on web:

Uncaught TypeError: room is undefined
    showRoom SpaceHierarchy.tsx:365
    onViewRoomClick SpaceHierarchy.tsx:807
    onViewRoomClick SpaceHierarchy.tsx:480
    onPreviewClick SpaceHierarchy.tsx:120
    React 14
    unstable_runWithPriority scheduler.development.js:468
    React 15
    loadApp init.tsx:150
    start index.ts:228
    async* index.ts:239
    <anonymous> bundle.js:1444
    __webpack_require__ bundle.js:838
    fn bundle.js:130
    <anonymous> bundle.js:1068
    __webpack_require__ bundle.js:838
    <anonymous> bundle.js:1055
    <anonymous> bundle.js:1058
2 SpaceHierarchy.tsx:365:8

@Johennes
Copy link
Contributor Author

Looks like /_matrix/client/v1/rooms/{roomId}/hierarchy doesn't return the new room. That in turn is likely because the new room seems to be missing the via parameter in

Old room

{
  "content": {
    "suggested": false,
    "via": [
      "matrix.org",
      "element.io",
      "riot.ovh"
    ]
  },
  "origin_server_ts": 1674562905343,
  "sender": "@johannesm:element.io",
  "state_key": "...",
  "type": "m.space.child",
  "unsigned": {
    "age": 241155595
  },
  "event_id": "...",
  "room_id": "..."
}

New room

{
  "content": {},
  "origin_server_ts": 1674662312761,
  "sender": "@johannesm:element.io",
  "state_key": "...",
  "type": "m.space.child",
  "unsigned": {
    "age": 141748160
  },
  "event_id": "...",
  "room_id": "..."
}

via is required and:

When not present or invalid, the child room is not considered to be part of the space.

@Johennes
Copy link
Contributor Author

And finally toLocalRoom converts the old room in the hierarchy returned by the server to the latest room in the room upgrade history:

const toLocalRoom = (cli: MatrixClient, room: IHierarchyRoom): IHierarchyRoom => {
    const history = cli.getRoomUpgradeHistory(room.room_id, true);
    const cliRoom = history[history.length - 1];
    if (cliRoom) {
        return {
            ...room,
            room_id: cliRoom.roomId,

So that explains why the room with the new ID is used in the room list.

@Johennes
Copy link
Contributor Author

So I think there are two bugs here:

  1. When upgrading the room, the new one was added into the old one's space but no via parameter was set, technically making it not part of the space.
  2. When resolving the latest room version, we don't verify whether the corresponding room is actually in the space or not.

@Johennes
Copy link
Contributor Author

Johennes commented Feb 2, 2023

So I think there are two bugs here:

1. When upgrading the room, the new one was added into the old one's space but no `via` parameter was set, technically making it _not_ part of the space.

2. When resolving the latest room version, we don't verify whether the corresponding room is actually in the space or not.
  1. was fixed with Ensure room is actually in space hierarchy when resolving its latest version matrix-org/matrix-react-sdk#10010.

@Johennes
Copy link
Contributor Author

Johennes commented Feb 3, 2023

I've tested this again locally for another room and I'm not able to reproduce issue 1 anymore. The via parameter is correctly set. Unsure what went wrong the last time. Closing this for now.

@Johennes Johennes closed this as completed Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Spaces Spaces, groups, communities O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

No branches or pull requests

2 participants