fix(editor): Fix SQL editors not always re-rendering when query changes (#8621)
This commit is contained in:
@@ -13,6 +13,7 @@ import type { EditorView } from '@codemirror/view';
|
||||
import type { TargetItem } from '@/Interface';
|
||||
import type { Html, Plaintext, RawSegment, Resolvable, Segment } from '@/types/expressions';
|
||||
import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
export const expressionManager = defineComponent({
|
||||
props: {
|
||||
@@ -98,12 +99,17 @@ export const expressionManager = defineComponent({
|
||||
|
||||
if (skipSegments.includes(node.type.name)) return;
|
||||
|
||||
rawSegments.push({
|
||||
const newSegment: RawSegment = {
|
||||
from: node.from,
|
||||
to: node.to,
|
||||
text,
|
||||
token: node.type.name === 'Resolvable' ? 'Resolvable' : 'Plaintext',
|
||||
});
|
||||
};
|
||||
|
||||
// Avoid duplicates
|
||||
if (isEqual(newSegment, rawSegments.at(-1))) return;
|
||||
|
||||
rawSegments.push(newSegment);
|
||||
});
|
||||
|
||||
return rawSegments.reduce<Segment[]>((acc, segment) => {
|
||||
|
||||
Reference in New Issue
Block a user