-
Notifications
You must be signed in to change notification settings - Fork 4
Set node summoning menu default trigger to @ #446
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
Set node summoning menu default trigger to @ #446
Conversation
Co-authored-by: mclicks <mclicks@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
…igger - Updated the NodeSearchMenuTriggerSetting and initObservers functions to use the getSetting utility for retrieving the default node search trigger, improving consistency and maintainability.
|
@CodeRabbit full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughCentralizes retrieval of the "node-search-trigger" setting by importing and using getSetting with a default "@" in DiscourseNodeSearchMenu.tsx and initializeObserversAndListeners.ts. Replaces direct extensionAPI.settings.get calls. No exported signatures changed; existing onChange and listener control flow remain intact. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant L as Key Listener
participant S as getSetting
participant A as extensionAPI.settings
participant M as DiscourseNodeSearchMenu
U->>L: Type character
L->>S: getSetting("node-search-trigger", "@")
S->>A: settings.get("node-search-trigger")
A-->>S: value | undefined
note right of S: Returns stored value or default "@"
S-->>L: trigger
alt trigger matches typed char
L->>M: Open node search menu
else
L-->>U: Ignore
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Pre-merge checks✅ Passed checks (3 passed)
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/initializeObserversAndListeners.ts (1)
234-234: Trigger value is snapshotted at init; won’t reflect runtime setting changes.If users change the trigger in settings, discourseNodeSearchTriggerListener will still use the old value until re-init. Fetch per event or subscribe to setting changes.
Apply this minimal change to read the latest value on each key event:
- const customTrigger = getSetting("node-search-trigger", "@"); + // Read the latest trigger on each key event to honor runtime changesAnd inside discourseNodeSearchTriggerListener:
- const discourseNodeSearchTriggerListener = (e: Event) => { + const discourseNodeSearchTriggerListener = (e: Event) => { + const customTrigger = getSetting("node-search-trigger", "@");Alternatively, cache and update via a settings onChange hook if available.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/roam/src/components/DiscourseNodeSearchMenu.tsx(2 hunks)apps/roam/src/utils/initializeObserversAndListeners.ts(2 hunks)
🔇 Additional comments (3)
apps/roam/src/components/DiscourseNodeSearchMenu.tsx (2)
28-28: Centralized setting retrieval looks good.Importing getSetting aligns this component with the new default behavior and reduces duplication.
540-541: Default trigger initialization is correct; confirm helper semantics.Assuming getSetting is synchronous and returns "" when explicitly set empty (vs. undefined), this is fine. If it’s async or needs extensionAPI context, wire that in or memoize via onloadArgs.
apps/roam/src/utils/initializeObserversAndListeners.ts (1)
48-48: LGTM on consolidating settings access.Using getSetting here keeps the default consistent across the app.
* Fix: Default node search trigger to '@' Co-authored-by: mclicks <mclicks@gmail.com> * Refactor: Replace direct API calls with getSetting for node search trigger - Updated the NodeSearchMenuTriggerSetting and initObservers functions to use the getSetting utility for retrieving the default node search trigger, improving consistency and maintainability. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Set the node summoning menu default trigger to '@' to improve discoverability and align with existing default setting patterns.
Linear Issue: ENG-459
Summary by CodeRabbit
Bug Fixes
Refactor