Skip to content

Commit e07f229

Browse files
fix(compass-global-writes): make global writes tab not appear for readonly and config/local/admin collections COMPASS-8447 (#6479)
* changes * specialish
1 parent 117c32f commit e07f229

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/compass-collection/src/components/collection-tab.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
33
import { type CollectionState, selectTab } from '../modules/collection-tab';
44
import { css, ErrorBoundary, TabNavBar } from '@mongodb-js/compass-components';
55
import CollectionHeader from './collection-header';
6+
import toNS from 'mongodb-ns';
67
import { useLogger } from '@mongodb-js/compass-logging/provider';
78
import {
89
useCollectionQueryBar,
@@ -118,10 +119,10 @@ function WithErrorBoundary({
118119
function useCollectionTabs(props: CollectionMetadata) {
119120
const pluginTabs = useCollectionSubTabs();
120121
const connectionInfoRef = useConnectionInfoRef();
121-
const isGlobalWritesSupported = useConnectionSupports(
122-
connectionInfoRef.current.id,
123-
'globalWrites'
124-
);
122+
const isGlobalWritesSupported =
123+
useConnectionSupports(connectionInfoRef.current.id, 'globalWrites') &&
124+
!props.isReadonly &&
125+
!toNS(props.namespace).specialish;
125126
return pluginTabs
126127
.filter((x) => {
127128
if (x.name === 'GlobalWrites' && !isGlobalWritesSupported) {

0 commit comments

Comments
 (0)