Skip to content

fix(navigation): route DM rooms to /direct before checking space parents#878

Open
Just-Insane wants to merge 2 commits into
SableClient:devfrom
Just-Insane:fix/dm-routing
Open

fix(navigation): route DM rooms to /direct before checking space parents#878
Just-Insane wants to merge 2 commits into
SableClient:devfrom
Just-Insane:fix/dm-routing

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

@Just-Insane Just-Insane commented May 19, 2026

Description

DM rooms with a space parent were being routed to the space URL instead of /direct. The navigation logic now checks whether the room is a DM first and routes to /direct/{roomId} regardless of space membership.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

The fix inserts an early isDM(room) guard at the top of the navigation URL resolver so DM rooms short-circuit to /direct/{roomId} before the space-parent walk runs.

@Just-Insane Just-Insane marked this pull request as ready for review May 19, 2026 23:15
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners May 19, 2026 23:15
Copilot AI review requested due to automatic review settings May 19, 2026 23:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect navigation where DM rooms that also belong to a space were being routed to a space URL instead of /direct/{roomId} by prioritizing DM routing before any space-parent resolution.

Changes:

  • Move the DM detection branch (mDirects.has(roomId)) to the top of navigateRoom to short-circuit to /direct.
  • Remove the now-redundant DM routing block later in the function.
  • Add a patch changeset documenting the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/app/hooks/useRoomNavigate.ts Prioritizes DM routing before space-parent navigation to prevent misrouting DMs into space URLs.
.changeset/dm-routing.md Adds a patch changeset entry describing the DM routing fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +40 to +44
// DM rooms always navigate to /direct, regardless of space membership.
if (mDirects.has(roomId)) {
navigate(getDirectRoomPath(roomIdOrAlias, eventId), opts);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants