Skip to content

fix(files): navigate sim file mentions - #7000

Open
BillLeoutsakosvl346 wants to merge 1 commit into
stagingfrom
fix/sim-file-navigation
Open

fix(files): navigate sim file mentions#7000
BillLeoutsakosvl346 wants to merge 1 commit into
stagingfrom
fix/sim-file-navigation

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make sim:file/{fileId} mention chips navigate on plain click in authenticated workspace Markdown file surfaces.
  • Keep Cmd/Ctrl-click opening the canonical target in a new tab through the existing resource-kind allowlist.
  • Correct file destinations to /workspace/{workspaceId}/files/{fileId} and encode workspace/resource IDs.
  • Give the collaborative read-only placeholder the same navigation configuration while keeping tagging disabled.
  • Leave public shares, modal rich Markdown fields, sanitizer policy, and custom-protocol registration unchanged.
  • Root cause: MentionChipView gated all navigation behind Cmd/Ctrl, while simLinkPath still emitted the obsolete /view suffix.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • 148 focused tests passed across mention-chip, sim-link, mention-node, Markdown round-trip, and Sim Page resolver coverage.
  • Targeted Biome check passed for the seven touched files.
  • apps/sim: bun run type-check passed before and after rebasing onto origin/staging.
  • Signed-in local browser-control verification passed:
    • source Markdown rendered the Target mention chip;
    • plain click navigated to the canonical file URL with no /view suffix;
    • Cmd-click opened the same canonical target in a new tab without moving the source tab;
    • the unchanged ID reference still resolved after renaming the target;
    • a public Markdown share rendered the chip but kept it inert.
  • Temporary files were moved to trash and the temporary public share was revoked.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Paired browser-control captures were recorded during the signed-in local verification:

  • sim-file-navigation-source-before.png: source file immediately before clicking the Target chip.
  • sim-file-navigation-destination-after.png: canonical destination showing Sim File Navigation Target 2026-08-22 after navigation.

@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 22, 2026 11:58pm

Request Review

@cursor

cursor Bot commented Aug 22, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Client-only mention click routing with an existing navigable allowlist; modal fields stay inert and IDs are now URI-encoded.

Overview
Makes navigable @ mention chips in the file viewer follow the resource on a plain click. Cmd/Ctrl-click still opens a new tab. Modal fields remain inert.

File destinations drop the obsolete /view suffix (/workspace/{id}/files/{fileId}). Workspace and resource IDs are encodeURIComponentd so special characters cannot break the path or query.

The collab read-only placeholder now uses the same navigable mention wiring (tagging still off) so chips work before the live editor seeds.

Reviewed by Cursor Bugbot for commit 9b547e3. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR enables ordinary-click navigation for file mention chips while preserving Cmd/Ctrl-click new-tab behavior and keeping non-navigable surfaces inert.

  • Corrects file mention destinations by removing the obsolete /view suffix.
  • Encodes workspace and resource identifiers in generated paths.
  • Configures collaborative read-only placeholders for navigation without enabling tagging.
  • Adds focused coverage for navigation, modifiers, inert states, canonical routes, and identifier encoding.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable correctness or security failures identified in the changed navigation paths.

The changed click behavior remains gated by per-editor navigation configuration and an allowlisted path resolver, while destination paths, identifier encoding, read-only placeholder behavior, and modifier-click handling align with the existing route and editor contracts.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-chip.tsx Expands navigable mention chips from modifier-only activation to plain-click routing while retaining Cmd/Ctrl-click new-tab behavior.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/sim-link.ts Produces encoded, allowlisted resource paths and corrects file links to the existing canonical route.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/rich-markdown-editor.tsx Gives the collaborative read-only placeholder isolated mention navigation configuration while keeping tagging disabled.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-chip.test.tsx Adds coverage for ordinary clicks, modifier clicks, and all configured inert cases.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/sim-link.test.ts Updates route expectations and verifies workspace and resource identifiers remain single encoded URL components.

Sequence Diagram

sequenceDiagram
  actor User
  participant Chip as Mention chip
  participant Path as simLinkPath
  participant Router as Next router
  participant Tab as New browser tab
  User->>Chip: Click mention
  Chip->>Path: Resolve allowlisted resource path
  alt Path unavailable or navigation disabled
    Path-->>Chip: null
    Chip-->>User: Remain inert
  else Cmd/Ctrl-click
    Path-->>Chip: Encoded canonical path
    Chip->>Tab: window.open(path, _blank)
  else Plain click
    Path-->>Chip: Encoded canonical path
    Chip->>Router: push(path)
  end
Loading

Reviews (1): Last reviewed commit: "fix(files): navigate sim file mentions" | Re-trigger Greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author
Canonical destination after navigation Source file before clicking the mention chip

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.

1 participant