Skip to content

Commit

Permalink
Move Toolbox database selection
Browse files Browse the repository at this point in the history
  • Loading branch information
darrellwarde committed Jul 18, 2023
1 parent aedc06c commit 8922bff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 8 additions & 2 deletions packages/graphql-toolbox/src/modules/EditorView/EditorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import { graphql } from "graphql";

import { tracking } from "../../analytics/tracking";
import { Extension } from "../../components/Filename";
import { EDITOR_PARAMS_INPUT, EDITOR_RESPONSE_OUTPUT } from "../../constants";
import { DEFAULT_DATABASE_NAME, EDITOR_PARAMS_INPUT, EDITOR_RESPONSE_OUTPUT } from "../../constants";
import { AuthContext } from "../../contexts/auth";
import { Screen } from "../../contexts/screen";
import { SettingsContext } from "../../contexts/settings";
import { useStore } from "../../store";
Expand All @@ -47,6 +48,7 @@ export interface Props {

export const EditorView = ({ schema }: Props) => {
const store = useStore();
const auth = useContext(AuthContext);
const settings = useContext(SettingsContext);
const [loading, setLoading] = useState<boolean>(false);
const [showDocs, setShowDocs] = useState<boolean>(false);
Expand All @@ -68,7 +70,11 @@ export const EditorView = ({ schema }: Props) => {
const response = await graphql({
schema: schema,
source: override || useStore.getState().getActiveTab().query || "",
contextValue: {},
contextValue: {
sessionConfig: {
database: auth.selectedDatabaseName || DEFAULT_DATABASE_NAME,
},
},
variableValues: safeParse(useStore.getState().getActiveTab().variables, {}),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ export const SchemaView = ({ onSchemaChange }: Props) => {
driver: auth.driver,
features,
debug: useStore.getState().enableDebug,
config: {
sessionConfig: {
database: auth.selectedDatabaseName || DEFAULT_DATABASE_NAME,
},
},
};

const neoSchema = new Neo4jGraphQL(options);
Expand Down

0 comments on commit 8922bff

Please sign in to comment.