Skip to content

Commit 2b90d85

Browse files
committed
chore: remove redundant bits
1 parent e96a8eb commit 2b90d85

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

packages/compass-aggregations/src/modules/insights.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,18 @@ interface FetchExplainPlanSuccessAction {
2424
}
2525
export type InsightsAction = FetchExplainPlanSuccessAction;
2626

27-
const INITIAL_STATE = { isCollectionScan: false, explainPlan: null };
27+
const INITIAL_STATE = { isCollectionScan: false };
2828

29-
const reducer: Reducer<
30-
{ isCollectionScan: boolean; explainPlan: ExplainPlan | null },
31-
Action
32-
> = (state = INITIAL_STATE, action) => {
29+
const reducer: Reducer<{ isCollectionScan: boolean }, Action> = (
30+
state = INITIAL_STATE,
31+
action
32+
) => {
3333
if (
3434
isAction<FetchExplainPlanSuccessAction>(action, FETCH_EXPLAIN_PLAN_SUCCESS)
3535
) {
3636
return {
3737
...state,
3838
isCollectionScan: action.explainPlan.isCollectionScan,
39-
explainPlan: action.explainPlan,
4039
};
4140
}
4241
if (

packages/compass-assistant/src/compass-assistant-provider.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export const AssistantContext = createContext<AssistantContextType | null>(
3131
);
3232

3333
type AssistantActionsContextType = {
34+
interpretExplainPlan: ({
35+
namespace,
36+
explainPlan,
37+
}: {
38+
namespace: string;
39+
explainPlan: string;
40+
}) => void;
3441
interpretConnectionError: ({
3542
connectionInfo,
3643
error,
@@ -39,7 +46,6 @@ type AssistantActionsContextType = {
3946
error: Error;
4047
}) => void;
4148
clearChat: () => void;
42-
interpretExplainPlan: (explainPlan: string) => void;
4349
};
4450
export const AssistantActionsContext =
4551
createContext<AssistantActionsContextType>({
@@ -83,7 +89,7 @@ export const AssistantProvider: React.FunctionComponent<
8389
}>
8490
> = ({ chat, children }) => {
8591
const assistantActionsContext = useRef<AssistantActionsContextType>({
86-
interpretExplainPlan: (explainPlan: string) => {
92+
interpretExplainPlan: ({ explainPlan }) => {
8793
openDrawer(ASSISTANT_DRAWER_ID);
8894
const { prompt, displayText } = buildExplainPlanPrompt({
8995
explainPlan,
@@ -151,7 +157,7 @@ export const CompassAssistantProvider = registerCompassPlugin(
151157
transport: new DocsProviderTransport({
152158
baseUrl: atlasService.assistantApiEndpoint(),
153159
}),
154-
onError: (err: any) => {
160+
onError: (err) => {
155161
logger.log.error(
156162
logger.mongoLogId(1_001_000_370),
157163
'Assistant',

0 commit comments

Comments
 (0)