From 1efd2c0ca26aea2ec979ae783b26a3e504a5f9d6 Mon Sep 17 00:00:00 2001 From: Basit Date: Mon, 25 Apr 2022 13:31:22 +0200 Subject: [PATCH 1/9] feat(aggregation): auto-preview toggle --- .../pipeline-extra-settings.tsx | 2 - .../stage-preview/stage-preview.jsx | 44 ++++++++++++++----- .../src/components/stage/stage.jsx | 1 + .../src/modules/auto-preview.js | 33 -------------- .../src/modules/auto-preview.spec.js | 6 +-- .../src/modules/auto-preview.ts | 41 +++++++++++++++++ 6 files changed, 78 insertions(+), 49 deletions(-) delete mode 100644 packages/compass-aggregations/src/modules/auto-preview.js create mode 100644 packages/compass-aggregations/src/modules/auto-preview.ts diff --git a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx index f551e85fe3e..4a59bbfc570 100644 --- a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx +++ b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx @@ -28,8 +28,6 @@ const toggleLabelStyles = css({ marginBottom: 0, padding: 0, textTransform: 'uppercase', - // todo: remove this post removal of global styles - margin: 'inherit !important', }); type PipelineExtraSettingsProps = { diff --git a/packages/compass-aggregations/src/components/stage-preview/stage-preview.jsx b/packages/compass-aggregations/src/components/stage-preview/stage-preview.jsx index bc99e0bc434..744120aff7a 100644 --- a/packages/compass-aggregations/src/components/stage-preview/stage-preview.jsx +++ b/packages/compass-aggregations/src/components/stage-preview/stage-preview.jsx @@ -33,7 +33,8 @@ class StagePreview extends Component { openLink: PropTypes.func.isRequired, index: PropTypes.number.isRequired, stageOperator: PropTypes.string, - stage: PropTypes.string + stage: PropTypes.string, + isAutoPreviewing: PropTypes.bool, } /** @@ -178,6 +179,17 @@ class StagePreview extends Component { ); } + renderEmptyIcon() { + return ( + + + + + + + ); + } + /** * Render the preview section. * @@ -218,14 +230,7 @@ class StagePreview extends Component { } return (
-
- - - - - - -
+
{this.renderEmptyIcon()}
No Preview Documents
@@ -247,6 +252,17 @@ class StagePreview extends Component { } } + renderAutoPreviewDisabled() { + return ( +
+
{this.renderEmptyIcon()}
+
+ Auto Preview Disabled +
+
+ ); + } + /** * Renders the stage preview. * @@ -255,8 +271,14 @@ class StagePreview extends Component { render() { return (
- {this.renderLoading()} - {this.renderPreview()} + { + !this.props.isAutoPreviewing + ? this.renderAutoPreviewDisabled() + : <> + {this.renderLoading()} + {this.renderPreview()} + + }
); } diff --git a/packages/compass-aggregations/src/components/stage/stage.jsx b/packages/compass-aggregations/src/components/stage/stage.jsx index f4db3c0e57b..3d4041f5f50 100644 --- a/packages/compass-aggregations/src/components/stage/stage.jsx +++ b/packages/compass-aggregations/src/components/stage/stage.jsx @@ -211,6 +211,7 @@ class Stage extends Component { gotoOutResults={this.props.gotoOutResults} gotoMergeResults={this.props.gotoMergeResults} openLink={this.props.openLink} + isAutoPreviewing={this.props.isAutoPreviewing} /> )}
diff --git a/packages/compass-aggregations/src/modules/auto-preview.js b/packages/compass-aggregations/src/modules/auto-preview.js deleted file mode 100644 index 5085f9b194e..00000000000 --- a/packages/compass-aggregations/src/modules/auto-preview.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Auto Preview toggled action name. - */ -export const TOGGLE_AUTO_PREVIEW = 'aggregations/autoPreview/TOGGLE_AUTO_PREVIEW'; - -/** - * The initial state. - */ -export const INITIAL_STATE = true; - -/** - * Reducer function for handle state changes to autoPreview. - * - * @param {Boolean} state - The auto preview state. - * @param {Object} action - The action. - * - * @returns {Boolean} The new state. - */ -export default function reducer(state = INITIAL_STATE, action) { - if (action.type === TOGGLE_AUTO_PREVIEW) { - return !state; - } - return state; -} - -/** - * Action creator for autoPreview toggling. - * - * @returns {Object} The toggle autoPreview action. - */ -export const toggleAutoPreview = () => ({ - type: TOGGLE_AUTO_PREVIEW -}); diff --git a/packages/compass-aggregations/src/modules/auto-preview.spec.js b/packages/compass-aggregations/src/modules/auto-preview.spec.js index 28280b52040..3ebc72d9e7d 100644 --- a/packages/compass-aggregations/src/modules/auto-preview.spec.js +++ b/packages/compass-aggregations/src/modules/auto-preview.spec.js @@ -1,11 +1,11 @@ -import reducer, { toggleAutoPreview, TOGGLE_AUTO_PREVIEW } from './auto-preview'; +import reducer, { toggleAutoPreview, ActionTypes } from './auto-preview'; import { expect } from 'chai'; describe('auto preview module', function() { describe('#toggleAutoPreview', function() { - it('returns the TOGGLE_AUTO_PREVIEW action', function() { + it('returns the AutoPreviewToggled action', function() { expect(toggleAutoPreview()).to.deep.equal({ - type: TOGGLE_AUTO_PREVIEW + type: ActionTypes.AutoPreviewToggled }); }); }); diff --git a/packages/compass-aggregations/src/modules/auto-preview.ts b/packages/compass-aggregations/src/modules/auto-preview.ts new file mode 100644 index 00000000000..eaedf2ca3a8 --- /dev/null +++ b/packages/compass-aggregations/src/modules/auto-preview.ts @@ -0,0 +1,41 @@ +import type { AnyAction } from "redux"; +import type { ThunkAction } from "redux-thunk"; +import type { RootState } from "."; +import { runStage } from "./pipeline"; + +export enum ActionTypes { + AutoPreviewToggled = 'compass-aggregations/autoPreviewToggled', +} + +type AutoPreviewToggledAction = { + type: ActionTypes.AutoPreviewToggled; +}; + +export const INITIAL_STATE = true; + +export default function reducer(state = INITIAL_STATE, action: AnyAction): boolean { + if (action.type === ActionTypes.AutoPreviewToggled) { + return !state; + } + return state; +} + +export const toggleAutoPreview = (): ThunkAction< + void, + RootState, + void, + AutoPreviewToggledAction +> => { + return (dispatch, getState) => { + const { + pipeline, + autoPreview, + } = getState(); + if (!autoPreview) { + pipeline.forEach((_stage, index) => dispatch(runStage(index))); + } + dispatch({ + type: ActionTypes.AutoPreviewToggled + }); + }; +}; From 172fbe145609de7271c561b83c95bb2d1bd1fa81 Mon Sep 17 00:00:00 2001 From: Basit Date: Mon, 25 Apr 2022 16:06:06 +0200 Subject: [PATCH 2/9] feat(aggregation): auto-preview toggle --- .../pipeline-extra-settings.tsx | 2 +- .../stage-editor-toolbar.jsx | 26 +++++++++- .../stage-preview/stage-preview.jsx | 44 ++++------------ .../src/components/stage/stage.jsx | 51 ++++++++++++------- .../src/components/stage/stage.module.less | 4 ++ 5 files changed, 74 insertions(+), 53 deletions(-) diff --git a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx index 4a59bbfc570..c87aceb718b 100644 --- a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx +++ b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx @@ -46,7 +46,7 @@ export const PipelineExtraSettings: React.FunctionComponent onToggleAutoPreview()} data-testid="pipeline-toolbar-preview-toggle" diff --git a/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx b/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx index a2140409bb7..6a2000998f7 100644 --- a/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx +++ b/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx @@ -7,6 +7,7 @@ import ToggleStage from './toggle-stage'; import StageGrabber from './stage-grabber'; import StageCollapser from './stage-collapser'; import StageOperatorSelect from './stage-operator-select'; +import { Tooltip } from 'hadron-react-components'; import styles from './stage-editor-toolbar.module.less'; @@ -34,9 +35,31 @@ class StageEditorToolbar extends PureComponent { stageDeleted: PropTypes.func.isRequired, setIsModified: PropTypes.func.isRequired, isCommenting: PropTypes.bool.isRequired, - runStage: PropTypes.func.isRequired + runStage: PropTypes.func.isRequired, + isAutoPreviewing: PropTypes.bool, }; + renderTooltip() { + const stages = { + $out: 'The $out operator will cause the pipeline to persist the results to the specified location (collection, S3, or Atlas). If the collection exists it will be replaced.', + $merge: 'The $merge operator will cause the pipeline to persist the results to the specified location.' + }; + const { isAutoPreviewing, stageOperator } = this.props; + if (!isAutoPreviewing && Object.keys(stages).includes(stageOperator)) { + return ( + + + + + ); + } + } + /** * Renders the stage editor toolbar. * @@ -76,6 +99,7 @@ class StageEditorToolbar extends PureComponent { stageToggled={this.props.stageToggled} />
+ {this.renderTooltip()} - - - - - - ); - } - /** * Render the preview section. * @@ -230,7 +218,14 @@ class StagePreview extends Component { } return (
-
{this.renderEmptyIcon()}
+
+ + + + + + +
No Preview Documents
@@ -252,17 +247,6 @@ class StagePreview extends Component { } } - renderAutoPreviewDisabled() { - return ( -
-
{this.renderEmptyIcon()}
-
- Auto Preview Disabled -
-
- ); - } - /** * Renders the stage preview. * @@ -271,14 +255,8 @@ class StagePreview extends Component { render() { return (
- { - !this.props.isAutoPreviewing - ? this.renderAutoPreviewDisabled() - : <> - {this.renderLoading()} - {this.renderPreview()} - - } + {this.renderLoading()} + {this.renderPreview()}
); } diff --git a/packages/compass-aggregations/src/components/stage/stage.jsx b/packages/compass-aggregations/src/components/stage/stage.jsx index 3d4041f5f50..e00ed30ce83 100644 --- a/packages/compass-aggregations/src/components/stage/stage.jsx +++ b/packages/compass-aggregations/src/components/stage/stage.jsx @@ -124,21 +124,7 @@ class Stage extends Component { renderEditor() { return ( - { this.resizableRef = c; }} - handleWrapperClass={styles['stage-resize-handle-wrapper']} - handleComponent={{ - right: , - }} - > + <> {this.props.isExpanded && ( )} + + ); + } + + renderResizableEditor() { + const { isAutoPreviewing } = this.props; + const editor = this.renderEditor(); + if (!isAutoPreviewing) { + return
{editor}
; + } + return ( + { + this.resizableRef = c; + }} + handleWrapperClass={styles['stage-resize-handle-wrapper']} + handleComponent={{ + right: , + }} + > + {editor} ); } @@ -211,7 +227,6 @@ class Stage extends Component { gotoOutResults={this.props.gotoOutResults} gotoMergeResults={this.props.gotoMergeResults} openLink={this.props.openLink} - isAutoPreviewing={this.props.isAutoPreviewing} /> )}
@@ -236,8 +251,8 @@ class Stage extends Component {
- {this.renderEditor()} - {this.renderPreview()} + {this.renderResizableEditor()} + {this.props.isAutoPreviewing && this.renderPreview()}
); diff --git a/packages/compass-aggregations/src/components/stage/stage.module.less b/packages/compass-aggregations/src/components/stage/stage.module.less index dfb6b1effe0..24cda03a2c4 100644 --- a/packages/compass-aggregations/src/components/stage/stage.module.less +++ b/packages/compass-aggregations/src/components/stage/stage.module.less @@ -85,3 +85,7 @@ align-items: stretch; border-radius: 0 0 4px 4px; } + +.stage-editor-no-preview { + width: 100%; +} From 44b3d26892d3d21f097178062d2a6dabf293df5d Mon Sep 17 00:00:00 2001 From: Basit Date: Mon, 25 Apr 2022 17:23:31 +0200 Subject: [PATCH 3/9] feat(aggregation): tests --- .../src/modules/auto-preview.spec.js | 26 -------- .../src/modules/auto-preview.spec.ts | 59 +++++++++++++++++++ 2 files changed, 59 insertions(+), 26 deletions(-) delete mode 100644 packages/compass-aggregations/src/modules/auto-preview.spec.js create mode 100644 packages/compass-aggregations/src/modules/auto-preview.spec.ts diff --git a/packages/compass-aggregations/src/modules/auto-preview.spec.js b/packages/compass-aggregations/src/modules/auto-preview.spec.js deleted file mode 100644 index 3ebc72d9e7d..00000000000 --- a/packages/compass-aggregations/src/modules/auto-preview.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -import reducer, { toggleAutoPreview, ActionTypes } from './auto-preview'; -import { expect } from 'chai'; - -describe('auto preview module', function() { - describe('#toggleAutoPreview', function() { - it('returns the AutoPreviewToggled action', function() { - expect(toggleAutoPreview()).to.deep.equal({ - type: ActionTypes.AutoPreviewToggled - }); - }); - }); - - describe('#reducer', function() { - context('when the action is not toggle auto preview', function() { - it('returns the default state', function() { - expect(reducer(undefined, { type: 'test' })).to.equal(true); - }); - }); - - context('when the action is toggle auto preview', function() { - it('returns the new state', function() { - expect(reducer(undefined, toggleAutoPreview())).to.equal(false); - }); - }); - }); -}); diff --git a/packages/compass-aggregations/src/modules/auto-preview.spec.ts b/packages/compass-aggregations/src/modules/auto-preview.spec.ts new file mode 100644 index 00000000000..a692c41f52b --- /dev/null +++ b/packages/compass-aggregations/src/modules/auto-preview.spec.ts @@ -0,0 +1,59 @@ +import { expect } from 'chai'; +import type { Store } from 'redux'; + +import { toggleAutoPreview } from './auto-preview'; +import type { RootState } from '.'; +import configureStore from '../stores/store'; +import { DATA_SERVICE_CONNECTED } from './data-service'; +import { spy } from 'sinon'; +import { stageOperatorSelected, stageChanged, stageAddedAfter } from './pipeline'; + +describe('auto preview module', function () { + let store: Store; + beforeEach(function () { + store = configureStore({}); + }) + + it('returns the default state', function () { + expect(store.getState().autoPreview).to.equal(true); + }); + + it('returns the new state', function () { + store.dispatch(toggleAutoPreview() as any); + expect(store.getState().autoPreview).to.equal(false); + }); + + it('runs stages when user enables auto-preview', function () { + const cursorMock = { + toArray: spy(), + close: spy(), + }; + const dataServiceMock = new class { + aggregate(...args) { + const callback = args[args.length - 1]; + callback(null, cursorMock); + } + }; + const aggregateSpy = spy(dataServiceMock, 'aggregate'); + + store.dispatch({ + type: DATA_SERVICE_CONNECTED, + dataService: dataServiceMock + }); + + store.dispatch(stageOperatorSelected(0, '$match', false, 'on-prem') as any); + store.dispatch(stageChanged(`{name: /berlin/i}`, 0) as any); + + store.dispatch(stageAddedAfter(0) as any); + store.dispatch(stageOperatorSelected(1, '$out', false, 'on-prem') as any); + store.dispatch(stageChanged(`'coll'`, 1) as any); + + + // by default autoPreview is true + store.dispatch(toggleAutoPreview() as any); // sets to false + store.dispatch(toggleAutoPreview() as any); // sets to true + + + expect(aggregateSpy.calledOnce, 'aggregates only once').to.be.true; + }); +}); From 14f50c27b61afba837dffc6c0cbff5fe0f1d29ed Mon Sep 17 00:00:00 2001 From: Basit Date: Mon, 25 Apr 2022 17:33:13 +0200 Subject: [PATCH 4/9] feat(aggregation): disable print margin --- .../src/components/stage-editor/stage-editor.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/compass-aggregations/src/components/stage-editor/stage-editor.jsx b/packages/compass-aggregations/src/components/stage-editor/stage-editor.jsx index 6e50e149de6..6bea363d318 100644 --- a/packages/compass-aggregations/src/components/stage-editor/stage-editor.jsx +++ b/packages/compass-aggregations/src/components/stage-editor/stage-editor.jsx @@ -219,6 +219,7 @@ class StageEditor extends Component { onFocus={() => { tools.setCompleters([this.completer]); }} + showPrintMargin={false} onLoad={(editor) => { this.editor = editor; this.editor.commands.addCommand({ From 84904b94468e5457248257691c3f01a2b2890d94 Mon Sep 17 00:00:00 2001 From: Basit Date: Tue, 26 Apr 2022 10:04:53 +0200 Subject: [PATCH 5/9] feat(aggregation): use ff for auto-preview toggle --- .../stage-editor-toolbar/stage-editor-toolbar.jsx | 4 ++-- .../stage-editor-toolbar.module.less | 4 ++++ .../compass-aggregations/src/components/stage/stage.jsx | 9 +++++++-- .../compass-aggregations/src/modules/auto-preview.ts | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx b/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx index 6a2000998f7..315f303bd26 100644 --- a/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx +++ b/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx @@ -53,7 +53,7 @@ class StageEditorToolbar extends PureComponent { data-place="left" data-html="true" > - + ); @@ -99,7 +99,7 @@ class StageEditorToolbar extends PureComponent { stageToggled={this.props.stageToggled} />
- {this.renderTooltip()} + {global?.process?.env?.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR === 'true' && this.renderTooltip()} {editor}
; } return ( @@ -240,6 +243,8 @@ class Stage extends Component { */ render() { const opacity = this.getOpacity(); + const isPreviewHidden = !this.props.isAutoPreviewing + && global?.process?.env?.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR ==='true'; return (
{this.renderResizableEditor()} - {this.props.isAutoPreviewing && this.renderPreview()} + {!isPreviewHidden && this.renderPreview()}
); diff --git a/packages/compass-aggregations/src/modules/auto-preview.ts b/packages/compass-aggregations/src/modules/auto-preview.ts index eaedf2ca3a8..725bd147702 100644 --- a/packages/compass-aggregations/src/modules/auto-preview.ts +++ b/packages/compass-aggregations/src/modules/auto-preview.ts @@ -31,7 +31,7 @@ export const toggleAutoPreview = (): ThunkAction< pipeline, autoPreview, } = getState(); - if (!autoPreview) { + if (!autoPreview && global?.process?.env?.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR === 'true') { pipeline.forEach((_stage, index) => dispatch(runStage(index))); } dispatch({ From a922510725967bce5b09e37f3999a93e2e1141da Mon Sep 17 00:00:00 2001 From: Basit Date: Tue, 26 Apr 2022 10:09:15 +0200 Subject: [PATCH 6/9] feat(aggregation): fix tests --- .../src/modules/auto-preview.spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/compass-aggregations/src/modules/auto-preview.spec.ts b/packages/compass-aggregations/src/modules/auto-preview.spec.ts index a692c41f52b..1e3a06f3adf 100644 --- a/packages/compass-aggregations/src/modules/auto-preview.spec.ts +++ b/packages/compass-aggregations/src/modules/auto-preview.spec.ts @@ -8,11 +8,18 @@ import { DATA_SERVICE_CONNECTED } from './data-service'; import { spy } from 'sinon'; import { stageOperatorSelected, stageChanged, stageAddedAfter } from './pipeline'; +const initialToolbarValue = process.env.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR; + describe('auto preview module', function () { let store: Store; beforeEach(function () { store = configureStore({}); - }) + process.env.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR = 'true'; + }); + + afterEach(function() { + process.env.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR = initialToolbarValue; + }); it('returns the default state', function () { expect(store.getState().autoPreview).to.equal(true); From 617d614a3c4a5e2924a22b7f47ac1dbfcf85d52a Mon Sep 17 00:00:00 2001 From: Basit Date: Tue, 26 Apr 2022 12:48:47 +0200 Subject: [PATCH 7/9] feat(aggregation): LG tooltip --- .../stage-editor-toolbar.jsx | 19 ++++++++++--------- .../stage-editor-toolbar.module.less | 6 ++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx b/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx index 315f303bd26..7de0aef3f66 100644 --- a/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx +++ b/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.jsx @@ -7,7 +7,7 @@ import ToggleStage from './toggle-stage'; import StageGrabber from './stage-grabber'; import StageCollapser from './stage-collapser'; import StageOperatorSelect from './stage-operator-select'; -import { Tooltip } from 'hadron-react-components'; +import { Tooltip, Body, Icon } from '@mongodb-js/compass-components'; import styles from './stage-editor-toolbar.module.less'; @@ -47,15 +47,16 @@ class StageEditorToolbar extends PureComponent { const { isAutoPreviewing, stageOperator } = this.props; if (!isAutoPreviewing && Object.keys(stages).includes(stageOperator)) { return ( - ( + + {children} + + + )} > - - - + {stages[stageOperator]} +
); } } diff --git a/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.module.less b/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.module.less index 3b23f9d63e5..1e88e4d019a 100644 --- a/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.module.less +++ b/packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.module.less @@ -31,6 +31,7 @@ display: flex; justify-content: flex-end; flex-grow: 4; + align-items: center; } &-errored { @@ -55,7 +56,8 @@ } } - .info-icon { - color: #464C4F !important; + .tooltip-icon { + margin-top: 6px; + margin-right: 6px; } } From 226c3f89470a597658c839417acae6a876ad52eb Mon Sep 17 00:00:00 2001 From: Basit <1305718+mabaasit@users.noreply.github.com> Date: Wed, 27 Apr 2022 12:32:15 +0200 Subject: [PATCH 8/9] Update packages/compass-aggregations/src/modules/auto-preview.ts Co-authored-by: Sergey Petushkov --- packages/compass-aggregations/src/modules/auto-preview.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compass-aggregations/src/modules/auto-preview.ts b/packages/compass-aggregations/src/modules/auto-preview.ts index 725bd147702..fa0ec0a07c2 100644 --- a/packages/compass-aggregations/src/modules/auto-preview.ts +++ b/packages/compass-aggregations/src/modules/auto-preview.ts @@ -32,7 +32,7 @@ export const toggleAutoPreview = (): ThunkAction< autoPreview, } = getState(); if (!autoPreview && global?.process?.env?.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR === 'true') { - pipeline.forEach((_stage, index) => dispatch(runStage(index))); + dispatch(runStage(0)) } dispatch({ type: ActionTypes.AutoPreviewToggled From 60dab98d7735c3b7bbaaddfd221c9bb51f64b0a5 Mon Sep 17 00:00:00 2001 From: Basit Date: Wed, 27 Apr 2022 14:54:10 +0200 Subject: [PATCH 9/9] feat(aggregation-count): remove unused var --- packages/compass-aggregations/src/modules/auto-preview.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/compass-aggregations/src/modules/auto-preview.ts b/packages/compass-aggregations/src/modules/auto-preview.ts index fa0ec0a07c2..679b6688862 100644 --- a/packages/compass-aggregations/src/modules/auto-preview.ts +++ b/packages/compass-aggregations/src/modules/auto-preview.ts @@ -28,7 +28,6 @@ export const toggleAutoPreview = (): ThunkAction< > => { return (dispatch, getState) => { const { - pipeline, autoPreview, } = getState(); if (!autoPreview && global?.process?.env?.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR === 'true') {