summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKit Langton <[email protected]>2026-02-07 14:35:15 -0500
committerGitHub <[email protected]>2026-02-07 13:35:15 -0600
commit0e1f5436465b17eed0ca1a4b11e63c549f691ecd (patch)
tree3449928bffa4be7ee1321c34e8ca90a878b0fb11
parentfb331f6cb87de6902477a18b73c231fe798daf98 (diff)
downloadopencode-0e1f5436465b17eed0ca1a4b11e63c549f691ecd.tar.gz
opencode-0e1f5436465b17eed0ca1a4b11e63c549f691ecd.zip
fix(web): keep /share available to copy existing link (#12533)
-rw-r--r--packages/app/src/pages/session/use-session-commands.tsx41
1 files changed, 26 insertions, 15 deletions
diff --git a/packages/app/src/pages/session/use-session-commands.tsx b/packages/app/src/pages/session/use-session-commands.tsx
index d50401d3f..0fe2c6044 100644
--- a/packages/app/src/pages/session/use-session-commands.tsx
+++ b/packages/app/src/pages/session/use-session-commands.tsx
@@ -357,30 +357,41 @@ export const useSessionCommands = (input: {
return [
{
id: "session.share",
- title: input.language.t("command.session.share"),
- description: input.language.t("command.session.share.description"),
+ title: input.info()?.share?.url ? "Copy share link" : input.language.t("command.session.share"),
+ description: input.info()?.share?.url
+ ? "Copy share URL to clipboard"
+ : input.language.t("command.session.share.description"),
category: input.language.t("command.category.session"),
slash: "share",
- disabled: !input.params.id || !!input.info()?.share?.url,
+ disabled: !input.params.id,
onSelect: async () => {
if (!input.params.id) return
- await input.sdk.client.session
- .share({ sessionID: input.params.id })
- .then((res) => {
- navigator.clipboard.writeText(res.data!.share!.url).catch(() =>
+ const copy = (url: string, existing: boolean) =>
+ navigator.clipboard
+ .writeText(url)
+ .then(() =>
+ showToast({
+ title: existing
+ ? input.language.t("session.share.copy.copied")
+ : input.language.t("toast.session.share.success.title"),
+ description: input.language.t("toast.session.share.success.description"),
+ variant: "success",
+ }),
+ )
+ .catch(() =>
showToast({
title: input.language.t("toast.session.share.copyFailed.title"),
variant: "error",
}),
)
- })
- .then(() =>
- showToast({
- title: input.language.t("toast.session.share.success.title"),
- description: input.language.t("toast.session.share.success.description"),
- variant: "success",
- }),
- )
+ const url = input.info()?.share?.url
+ if (url) {
+ await copy(url, true)
+ return
+ }
+ await input.sdk.client.session
+ .share({ sessionID: input.params.id })
+ .then((res) => copy(res.data!.share!.url, false))
.catch(() =>
showToast({
title: input.language.t("toast.session.share.failed.title"),