radicle-dev/radicle-upstream

Improve opening patches custom protocol handling

Closed this issue · 1 comments

When a user clicks on a custom protocol link that opens a patch in Upstream, but the patch hasn't been replicated yet, we get an

error message.
{
  "stack": "Error: Failed to fetch patch\n    at f (file:///Applications/Radicle%20Upstream.app/Contents/Resources/app.asar/public/bundle.js:67:298542)",
  "message": "Failed to fetch patch",
  "source": {
    "stack": "Error: Patch not found\n    at file:///Applications/Radicle%20Upstream.app/Contents/Resources/app.asar/public/bundle.js:67:298440\n    at async file:///Applications/Radicle%20Upstream.app/Contents/Resources/app.asar/public/bundle.js:67:298347\n    at async f (file:///Applications/Radicle%20Upstream.app/Contents/Resources/app.asar/public/bundle.js:67:298325)",
    "message": "Patch not found",
    "code": "UnknownException",
    "details": {
      "name": "Error"
    }
  }
}

It would be nicer if we could do this instead:

  • user clicks link custom protocol link (e.g.: radicle://upstream/v0/project/rad:git:hnrk8ueib11sen1g9n1xbt71qdns9n4gipw1o/patch/hydqsnkr181w1zfidtocgosxghdu8n8d1wsemzgtszhzjru55ggazk/ds-fixups)
  • upstream opens and queries backend and shows the patch immediately if it exists
  • if it doesn't exist, show notification that doesn't auto-hide: "Looking for patch..."
  • poll the backend for 15 seconds
  • if it finds the patch, show it and hide the notification
  • after the 15 seconds, hide the first notification and show a new one: "Couldn't find the patch | retry?"

Fixed via:
c4fa7c9
aee1f1c