Skip to content

Commit 45cf375

Browse files
committed
fix lint issues for opening from nudge
1 parent b0f3436 commit 45cf375

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

packages/compass-crud/src/stores/crud-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,7 @@ class CrudStoreImpl
18341834

18351835
openCreateIndexModal() {
18361836
this.localAppRegistry.emit('open-create-index-modal', {
1837-
query: EJSON.serialize(this.queryBar.getLastAppliedQuery('crud')),
1837+
query: EJSON.serialize(this.queryBar.getLastAppliedQuery('crud').filter),
18381838
});
18391839
}
18401840

packages/compass-indexes/src/components/create-index-form/create-index-form.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { usePreference } from 'compass-preferences-model/provider';
2121
import IndexFlowSection from './index-flow-section';
2222
import QueryFlowSection from './query-flow-section';
2323
import toNS from 'mongodb-ns';
24-
import type { Document } from 'bson';
2524

2625
const createIndexModalFieldsStyles = css({
2726
margin: `${spacing[600]}px 0 ${spacing[800]}px 0`,
@@ -50,7 +49,7 @@ export type CreateIndexFormProps = {
5049
onRemoveFieldClick: (idx: number) => void; // Minus icon.
5150
onTabClick: (tab: Tab) => void;
5251
showIndexesGuidanceVariant?: boolean;
53-
query: Document | null;
52+
query: string | null;
5453
};
5554

5655
function CreateIndexForm({

packages/compass-indexes/src/components/create-index-form/index-flow-section.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ import { errorEncountered, type Field } from '../../modules/create-index';
1717
import MDBCodeViewer from './mdb-code-viewer';
1818
import { areAllFieldsFilledIn } from '../../utils/create-index-modal-validation';
1919
import { connect } from 'react-redux';
20-
import {
21-
TrackFunction,
22-
useTelemetry,
23-
} from '@mongodb-js/compass-telemetry/provider';
20+
import type { TrackFunction } from '@mongodb-js/compass-telemetry/provider';
21+
import { useTelemetry } from '@mongodb-js/compass-telemetry/provider';
2422

2523
const flexContainerStyles = css({
2624
display: 'flex',
@@ -212,7 +210,7 @@ const IndexFlowSection = ({
212210
showCoveredQueries: true,
213211
});
214212
} catch (e) {
215-
onErrorEncountered(e.message);
213+
onErrorEncountered(e instanceof Error ? e.message : String(e));
216214
}
217215

218216
setHasFieldChanges(false);

packages/compass-indexes/src/components/create-index-form/query-flow-section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ const QueryFlowSection = ({
106106
}: SuggestedIndexFetchedProps) => Promise<void>;
107107
indexSuggestions: Record<string, number> | null;
108108
fetchingSuggestionsState: IndexSuggestionState;
109-
initialQuery: Document | null;
109+
initialQuery: string | null;
110110
}) => {
111111
const [inputQuery, setInputQuery] = React.useState(
112-
JSON.stringify(initialQuery?.filter, null, 2)
112+
initialQuery ? JSON.stringify(initialQuery, null, 2) : ''
113113
);
114114
const [hasNewChanges, setHasNewChanges] = React.useState(
115115
initialQuery !== null

packages/compass-indexes/src/components/create-index-modal/create-index-modal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ import {
2929
import { useConnectionInfoRef } from '@mongodb-js/compass-connections/provider';
3030
import { usePreference } from 'compass-preferences-model/provider';
3131
import CreateIndexModalHeader from './create-index-modal-header';
32-
import type { Document } from 'bson';
3332

3433
type CreateIndexModalProps = React.ComponentProps<typeof CreateIndexForm> & {
3534
isVisible: boolean;
3635
namespace: string;
3736
error: string | null;
3837
currentTab: Tab;
39-
query: Document | null;
38+
query: string | null;
4039
onErrorBannerCloseClick: () => void;
4140
onCreateIndexClick: () => void;
4241
onCancelCreateIndexClick: () => void;

0 commit comments

Comments
 (0)