Feat: Fixed the issue where the prompt always displayed the initial value when switching between different generate operators #4764 (#4808)

### What problem does this PR solve?

Feat: Fixed the issue where the prompt always displayed the initial
value when switching between different generate operators #4764

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-02-08 18:25:25 +08:00
committed by GitHub
parent bfcc2abe47
commit a357190eff
7 changed files with 63 additions and 20 deletions

View File

@ -33,6 +33,7 @@ import { FlowFormContext } from '@/pages/flow/context';
import { useBuildComponentIdSelectOptions } from '@/pages/flow/hooks/use-get-begin-query';
import { $createVariableNode } from './variable-node';
import { ProgrammaticTag } from './constant';
import './index.css';
class VariableInnerOption extends MenuOption {
label: string;
@ -215,9 +216,12 @@ export default function VariablePickerMenuPlugin({
useEffect(() => {
if (editor && value && isFirstRender.current) {
isFirstRender.current = false;
editor.update(() => {
parseTextToVariableNodes(value);
});
editor.update(
() => {
parseTextToVariableNodes(value);
},
{ tag: ProgrammaticTag },
);
}
}, [parseTextToVariableNodes, editor, value]);