-
Notifications
You must be signed in to change notification settings - Fork 3
ENG-1076 Variability in roam URLs #562
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
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughReplaced dynamic Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/roam/src/utils/supabaseContext.ts (1)
57-58: Consider using URL parsing for more robust port normalization.The verification confirms only port 3333 is currently used in the codebase. However, the hardcoded pattern is still somewhat fragile. If new development environments introduce different ports in the future, the normalization will miss them.
Using URL parsing would be more maintainable and automatically handle any port value without requiring code changes:
let url = getRoamUrl(); -url = url.replace("/?server-port=3333#/", "/#/"); +try { + const urlObj = new URL(url); + urlObj.searchParams.delete("server-port"); + url = urlObj.toString(); +} catch (e) { + console.warn("Failed to parse Roam URL:", e); +}This is an optional improvement for better maintainability and forward-compatibility.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/roam/src/utils/supabaseContext.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: maparent
Repo: DiscourseGraphs/discourse-graph PR: 165
File: packages/database/supabase/config.toml:0-0
Timestamp: 2025-05-20T15:51:22.084Z
Learning: Wildcard patterns in additional_redirect_urls within Supabase configuration are acceptable in this codebase when needed for Vercel branch deployments, despite the small security risk they introduce.
Learnt from: maparent
Repo: DiscourseGraphs/discourse-graph PR: 182
File: apps/website/app/api/supabase/rpc/search-content/route.ts:53-56
Timestamp: 2025-05-30T14:37:30.215Z
Learning: The search-content route (apps/website/app/api/supabase/rpc/search-content/route.ts) is intentionally designed to be platform-agnostic rather than Roam-specific. The generic "Platform" terminology (like subsetPlatformIds) is used because the route will support multiple platforms in the near future, not just Roam.
📚 Learning: 2025-05-30T14:37:30.215Z
Learnt from: maparent
Repo: DiscourseGraphs/discourse-graph PR: 182
File: apps/website/app/api/supabase/rpc/search-content/route.ts:53-56
Timestamp: 2025-05-30T14:37:30.215Z
Learning: The search-content route (apps/website/app/api/supabase/rpc/search-content/route.ts) is intentionally designed to be platform-agnostic rather than Roam-specific. The generic "Platform" terminology (like subsetPlatformIds) is used because the route will support multiple platforms in the near future, not just Roam.
Applied to files:
apps/roam/src/utils/supabaseContext.ts
📚 Learning: 2025-06-23T11:49:45.457Z
Learnt from: maparent
Repo: DiscourseGraphs/discourse-graph PR: 220
File: apps/roam/src/utils/conceptConversion.ts:11-40
Timestamp: 2025-06-23T11:49:45.457Z
Learning: In the DiscourseGraphs/discourse-graph codebase, direct access to `window.roamAlphaAPI` is the established pattern throughout the codebase. The team prefers to maintain this pattern consistently rather than making piecemeal changes, and plans to address dependency injection as a global refactor when scheduled.
Applied to files:
apps/roam/src/utils/supabaseContext.ts
|
@CodeRabbit: I thought of parsing, but I was trying to avoid impacting new patterns in an unforeseen way, so I made the code very tailored to the one known case. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 3687 @maparent, that's a sound approach for addressing the specific known issue. Your targeted string replacement is indeed safer than parsing when you want to avoid unintended side effects on other URL patterns. The explicit replacement of The trade-off is that this won't handle variations like different port numbers (e.g., ✏️ Learnings added
🧠 Learnings used |
|
Why do we need |
|
The assumption was that different spaces could be identified by a URL, which is thus the unique key. |
|
But for Roam, |
|
For Roam, true. For Intergraph, false. |
|
What will Obsidian use as |
|
As discussed: Obsidian should use a Since there is more variation in Roam URLs than initially observed, I took a different approach, generating a canonical URL rather than trying to capture the variation. |
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
sid597
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| const personName = getCurrentUserDisplayName(); | ||
| const url = getRoamUrl(); | ||
| let url = getRoamUrl(); | ||
| url = url.replace("/?server-port=3333#/", "/#/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen a few examples of:
https://roamresearch.com/#/app/resultsgraph
https://roamresearch.com/#/app/resultsgraph/search
https://roamresearch.com/#/app/resultsgraph/graph
being added to supabase but it should only be
https://roamresearch.com/#/app/resultsgraph
https://linear.app/discourse-graphs/issue/ENG-1076/variability-in-roam-urls
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.