diff --git a/frontend/src2/query/components/ScriptQueryEditor.vue b/frontend/src2/query/components/ScriptQueryEditor.vue index b421e627..cdd0e275 100644 --- a/frontend/src2/query/components/ScriptQueryEditor.vue +++ b/frontend/src2/query/components/ScriptQueryEditor.vue @@ -4,20 +4,18 @@ import { LoadingIndicator } from 'frappe-ui' import { Bug, Play, RefreshCw } from 'lucide-vue-next' import { computed, inject, ref } from 'vue' import Code from '../../components/Code.vue' -import DataTable from '../../components/DataTable.vue' -import { Query } from '../query' import ContentEditable from '../../components/ContentEditable.vue' -import { attachRealtimeListener } from '../../helpers' +import DataTable from '../../components/DataTable.vue' +import { attachRealtimeListener, wheneverChanges } from '../../helpers' import session from '../../session' +import { Query } from '../query' const query = inject('query')! query.autoExecute = false const operation = query.getCodeOperation() const code = ref(operation ? operation.code : '') -function execute() { - query.setCode({ code: code.value }) -} +wheneverChanges(code, () => query.setCode({ code: code.value }), { debounce: 500 }) const columns = computed(() => query.result.columns) const rows = computed(() => query.result.formattedRows) @@ -77,7 +75,7 @@ attachRealtimeListener('insights_script_log', (data: any) => {
-