Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(views): navigate to issue in same tab instead of opening new tab (#773)
Jiayuan Zhang4285549381a3
diff --git a/packages/views/editor/extensions/mention-view.tsx b/packages/views/editor/extensions/mention-view.tsxindex 6dae9df0ce..f9170d0123 100644--- a/packages/views/editor/extensions/mention-view.tsx+++ b/packages/views/editor/extensions/mention-view.tsx@@ -53,7 +53,7 @@ function IssueMention({}) {const wsId = useWorkspaceId();const { data: issues = [] } = useQuery(issueListOptions(wsId));- const { openInNewTab } = useNavigation();+ const { push, openInNewTab } = useNavigation();const issue = issues.find((i) => i.id === issueId);const issuePath = `/issues/${issueId}`;@@ -61,11 +61,13 @@ function IssueMention({const handleClick = (e: React.MouseEvent) => {e.preventDefault();e.stopPropagation();- if (openInNewTab) {- openInNewTab(issuePath, tabTitle);- } else {- window.open(issuePath, "_blank", "noopener,noreferrer");+ if (e.metaKey || e.ctrlKey || e.shiftKey) {+ if (openInNewTab) {+ openInNewTab(issuePath, tabTitle);+ }+ return;}+ push(issuePath);};const cardClass =diff --git a/packages/views/editor/readonly-content.tsx b/packages/views/editor/readonly-content.tsxindex 2c65200b6f..97bd9020cb 100644--- a/packages/views/editor/readonly-content.tsx+++ b/packages/views/editor/readonly-content.tsx@@ -86,7 +86,7 @@ function urlTransform(url: string): string {// ---------------------------------------------------------------------------function IssueMentionLink({ issueId, label }: { issueId: string; label?: string }) {- const { openInNewTab } = useNavigation();+ const { push, openInNewTab } = useNavigation();const path = `/issues/${issueId}`;return (<span@@ -94,11 +94,13 @@ function IssueMentionLink({ issueId, label }: { issueId: string; label?: stringonClick={(e) => {e.preventDefault();e.stopPropagation();- if (openInNewTab) {- openInNewTab(path, label);- } else {- window.open(path, "_blank", "noopener,noreferrer");+ if (e.metaKey || e.ctrlKey || e.shiftKey) {+ if (openInNewTab) {+ openInNewTab(path, label);+ }+ return;}+ push(path);}}><IssueMentionCard issueId={issueId} fallbackLabel={label} />