Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Fix NDV output tabs resetting on any click #8808

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ export default defineComponent({

this.isFocused = false;

this.$emit('blur');

if (wasFocused) {
this.$emit('blur');

const telemetryPayload = createExpressionTelemetryPayload(
this.segments,
this.modelValue,
Expand Down
10 changes: 6 additions & 4 deletions packages/editor-ui/src/components/RunData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ import { useNDVStore } from '@/stores/ndv.store';
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import { useNodeHelpers } from '@/composables/useNodeHelpers';
import { useToast } from '@/composables/useToast';
import { isObject } from 'lodash-es';
import { isEqual, isObject } from 'lodash-es';
import { useExternalHooks } from '@/composables/useExternalHooks';
import { useSourceControlStore } from '@/stores/sourceControl.store';
import RunDataPinButton from '@/components/RunDataPinButton.vue';
Expand Down Expand Up @@ -1473,7 +1473,8 @@ export default defineComponent({
},
},
watch: {
node() {
node(newNode: INodeUi, prevNode: INodeUi) {
if (newNode.id === prevNode.id) return;
this.init();
},
hasNodeRun() {
Expand All @@ -1491,9 +1492,10 @@ export default defineComponent({
immediate: true,
deep: true,
},
jsonData(value: IDataObject[]) {
jsonData(data: IDataObject[], prevData: IDataObject[]) {
if (isEqual(data, prevData)) return;
this.refreshDataSize();
this.showPinDataDiscoveryTooltip(value);
this.showPinDataDiscoveryTooltip(data);
},
binaryData(newData: IBinaryKeyData[], prevData: IBinaryKeyData[]) {
if (newData.length && !prevData.length && this.displayMode !== 'binary') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,24 @@ describe('ExpressionParameterInput', () => {
await userEvent.click(getByTestId('expander'));
expect(emitted().modalOpenerClick).toEqual(expected);
});

test('it should only emit blur when input had focus', async () => {
const { getByTestId, emitted, baseElement } = renderComponent({
props: {
modelValue: '={{$json.foo}}',
},
});

// trigger click outside -> blur
await userEvent.click(baseElement);
expect(emitted('blur')).toBeUndefined();

// focus expression editor
await userEvent.click(
getByTestId('inline-expression-editor-input').querySelector('.cm-line') as Element,
);
// trigger click outside -> blur
await userEvent.click(baseElement);
expect(emitted('blur')).toHaveLength(1);
});
});
Loading