Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createContext, useContext } from 'react';

export const InstanceContext = createContext<MongoDBInstance | null>(null);

export const useMongoDBInstance = (): MongoDBInstance => {
export const mongoDBInstanceLocator = (): MongoDBInstance => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@addaleax don't know if you have a strong preference here, I thought that I'd rename it to match other methods we have and to indicate a bit better that it's not supposed to be used as a hook in React (even though it sorta is).

I think if we want to add actual hooks here (should be very valuable in some cases!), those should probably be a bit more high level, encapsulating the model subscription logic for a required field internally instead of just exposing the modal to the React view 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, no strong preferences here! happy to stick to whatever pattern we choose 🙂

const instance = useContext(InstanceContext);
if (!instance) {
throw new Error('No MongoDBInstance available in this context');
Expand Down
6 changes: 2 additions & 4 deletions packages/compass-home/src/components/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ import { CompassSettingsPlugin } from '@mongodb-js/compass-settings';
import { CreateViewPlugin } from '@mongodb-js/compass-aggregations';
import { CompassFindInPagePlugin } from '@mongodb-js/compass-find-in-page';
import {
CreateDatabasePlugin,
CreateCollectionPlugin,
CreateNamespacePlugin,
DropNamespacePlugin,
} from '@mongodb-js/compass-databases-collections';
import { ImportPlugin, ExportPlugin } from '@mongodb-js/compass-import-export';
Expand Down Expand Up @@ -359,6 +358,7 @@ function Home({
<ImportPlugin></ImportPlugin>
<ExportPlugin></ExportPlugin>
<CreateViewPlugin></CreateViewPlugin>
<CreateNamespacePlugin></CreateNamespacePlugin>
<DropNamespacePlugin></DropNamespacePlugin>
<Workspace namespace={namespace} />
</CompassInstanceStorePlugin>
Expand Down Expand Up @@ -386,8 +386,6 @@ function Home({
</div>
<CompassSettingsPlugin></CompassSettingsPlugin>
<CompassFindInPagePlugin></CompassFindInPagePlugin>
<CreateDatabasePlugin></CreateDatabasePlugin>
<CreateCollectionPlugin></CreateCollectionPlugin>
<AtlasSignIn></AtlasSignIn>
</SignalHooksProvider>
);
Expand Down
2 changes: 2 additions & 0 deletions packages/databases-collections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"reformat": "npm run prettier -- --write . && npm run eslint . --fix"
},
"peerDependencies": {
"@mongodb-js/compass-app-stores": "^7.6.1",
"@mongodb-js/compass-components": "^1.19.0",
"@mongodb-js/compass-editor": "^0.18.0",
"@mongodb-js/compass-logging": "^1.2.6",
Expand Down Expand Up @@ -87,6 +88,7 @@
"sinon": "^9.2.3"
},
"dependencies": {
"@mongodb-js/compass-app-stores": "^7.6.1",
"@mongodb-js/compass-components": "^1.19.0",
"@mongodb-js/compass-editor": "^0.18.0",
"@mongodb-js/compass-logging": "^1.2.6",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading