mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
fix(editor): Debounce expression changes (#8629)
This commit is contained in:
parent
68498cb72a
commit
9c7e0266ee
|
@ -62,6 +62,7 @@ import { createExpressionTelemetryPayload } from '@/utils/telemetryUtils';
|
|||
import type { Segment } from '@/types/expressions';
|
||||
import type { TargetItem } from '@/Interface';
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
import { useDebounce } from '@/composables/useDebounce';
|
||||
|
||||
type InlineExpressionEditorInputRef = InstanceType<typeof InlineExpressionEditorInput>;
|
||||
|
||||
|
@ -96,6 +97,10 @@ export default defineComponent({
|
|||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const { callDebounced } = useDebounce();
|
||||
return { callDebounced };
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isFocused: false,
|
||||
|
@ -154,7 +159,10 @@ export default defineComponent({
|
|||
this.$telemetry.track('User closed Expression Editor', telemetryPayload);
|
||||
}
|
||||
},
|
||||
onChange({ value, segments }: { value: string; segments: Segment[] }) {
|
||||
onChange(value: { value: string; segments: Segment[] }) {
|
||||
void this.callDebounced(this.onChangeDebounced, { debounceTime: 100, trailing: true }, value);
|
||||
},
|
||||
onChangeDebounced({ value, segments }: { value: string; segments: Segment[] }) {
|
||||
this.segments = segments;
|
||||
|
||||
if (this.isDragging) return;
|
||||
|
|
Loading…
Reference in a new issue