Skip to content

Commit

Permalink
fix(compass-global-writes): make global writes tab not appear for rea…
Browse files Browse the repository at this point in the history
…donly and config/local/admin collections COMPASS-8447 (#6479)

* changes

* specialish
  • Loading branch information
djechlin-mongodb authored Nov 13, 2024
1 parent 117c32f commit e07f229
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/compass-collection/src/components/collection-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import { type CollectionState, selectTab } from '../modules/collection-tab';
import { css, ErrorBoundary, TabNavBar } from '@mongodb-js/compass-components';
import CollectionHeader from './collection-header';
import toNS from 'mongodb-ns';
import { useLogger } from '@mongodb-js/compass-logging/provider';
import {
useCollectionQueryBar,
Expand Down Expand Up @@ -118,10 +119,10 @@ function WithErrorBoundary({
function useCollectionTabs(props: CollectionMetadata) {
const pluginTabs = useCollectionSubTabs();
const connectionInfoRef = useConnectionInfoRef();
const isGlobalWritesSupported = useConnectionSupports(
connectionInfoRef.current.id,
'globalWrites'
);
const isGlobalWritesSupported =
useConnectionSupports(connectionInfoRef.current.id, 'globalWrites') &&
!props.isReadonly &&
!toNS(props.namespace).specialish;
return pluginTabs
.filter((x) => {
if (x.name === 'GlobalWrites' && !isGlobalWritesSupported) {
Expand Down

0 comments on commit e07f229

Please sign in to comment.