fix: Only show editing stats toggle when viewing a document (#13530)

* fix: Only show editing stats toggle when viewing a document

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Default isViewing to false

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tom MoorandClaude Opus 5 authored and GitHub committed 2026-08-23 13:54:35 +00:00
1 parent e22b423fc3
commit c8bfd8488d
2 files changed
+14 -2

No files matched your search

+13 -2
View File
@@ -45,6 +45,8 @@ import { useTemplateMenuActions } from "./useTemplateMenuActions";
type Props = {
/** Document ID for which the actions are generated */
documentId: string;
/** Whether the document is currently being viewed */
isViewing?: boolean;
/** Invoked when the "Find and replace" menu item is clicked */
onFindAndReplace?: () => void;
/** Invoked when the "Rename" menu item is clicked */
@@ -55,6 +57,7 @@ type Props = {
export function useDocumentMenuAction({
documentId,
isViewing = false,
onFindAndReplace,
onRename,
onSelectTemplate,
@@ -106,7 +109,7 @@ export function useDocumentMenuAction({
openDocumentComments,
openDocumentHistory,
openDocumentInsights,
toggleDocumentStats,
...(isViewing ? [toggleDocumentStats] : []),
openDocumentInSplit,
openDocumentInDesktop,
presentDocument,
@@ -118,6 +121,14 @@ export function useDocumentMenuAction({
permanentlyDeleteDocument,
leaveDocument,
]),
[t, isMobile, templateMenuActions, documentId, onFindAndReplace, onRename]
[
t,
isMobile,
isViewing,
templateMenuActions,
documentId,
onFindAndReplace,
onRename,
]
);
}
+1
View File
@@ -129,6 +129,7 @@ function DocumentMenu({
const rootAction = useDocumentMenuAction({
documentId: document.id,
isViewing: showDisplayOptions,
onFindAndReplace,
onRename,
onSelectTemplate,