fix(desktop): dedupe Nostr session deep link imports#9918
Conversation
Signed-off-by: harrykamboj1 <singhharnoor116@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f0e62bc81
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!pendingDeepLinks.has(targetWindow.id)) { | ||
| pendingDeepLinks.set(targetWindow.id, url); | ||
| } |
There was a problem hiding this comment.
Avoid dropping newer pending deep links
When the target window is still loading, this has guard keeps the first pending URL and silently ignores every later extension/session deep link for the same window, even when the URL is different. During startup or a renderer reload, opening an extension link and then a Nostr/session link before react-ready means only the stale first URL is delivered at react-ready; the newer user action is lost. The dedupe should only collapse identical URLs or queue/replace distinct pending links.
Useful? React with 👍 / 👎.
|
Thanks for the fix and the detailed issue (#9917) — nice to see a small, well-scoped change with repro and before/after screenshots. A couple of things before this can land:
I'll snooze this for a few days to give you a chance to respond. |
Signed-off-by: harrykamboj1 <singhharnoor116@gmail.com>
|
Hi @DOsinga
Let me know if you'd like anything else adjusted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a5ec09466
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| const DEEPLINK_BURST_DEDUP_MS = 2000; | ||
| let lastSentSessionDeepLink: { url: string; at: number } | null = null; |
There was a problem hiding this comment.
Track all recent session links during burst dedup
With two different session/Nostr links opened during the same 2s macOS duplicate burst, this single-slot cache only suppresses adjacent duplicates. For an event order A, B, A, sending B overwrites A's timestamp, so the later duplicate A is sent to the renderer again and can still create a duplicate Nostr import. Keep recent send times keyed by URL until the burst window expires instead of storing only the last URL.
Useful? React with 👍 / 👎.
Summary
Fix duplicate Nostr session imports from
goose://sessions/nostrdeep links.macOS could deliver multiple
open-urlevents for one Chrome paste, triggeringseveral
POST /sessions/import/nostrcalls.Changes:
main.ts: queue links while window loading, 2s burst dedup, align macOS with Windows behaviorApp.tsx: in-flight + post-success dedup for Nostr deep link imports onlyTesting
Manual testing on macOS:
Related Issues
Fixes #9917
Screenshots
Before: multiple identical sessions in Chat History from one link

After: single session imported
