@@ -21,11 +21,11 @@ import useWorkflowNodeDetailsPanelStore from '@/pages/platform/workflow-editor/s
2121import deleteProperty from '@/pages/platform/workflow-editor/utils/deleteProperty' ;
2222import getInputHTMLType from '@/pages/platform/workflow-editor/utils/getInputHTMLType' ;
2323import saveProperty from '@/pages/platform/workflow-editor/utils/saveProperty' ;
24- import { Option } from '@/shared/middleware/platform/configuration' ;
25- import { useGetWorkflowNodeParameterDisplayConditionsQuery } from '@/shared/queries/platform/workflowNodeParameters.queries' ;
24+ import { GetWorkflowNodeParameterDisplayConditions200Response , Option } from '@/shared/middleware/platform/configuration' ;
2625import { ArrayPropertyType , PropertyAllType } from '@/shared/types' ;
2726import { QuestionMarkCircledIcon } from '@radix-ui/react-icons' ;
2827import { TooltipPortal } from '@radix-ui/react-tooltip' ;
28+ import { UseQueryResult } from '@tanstack/react-query' ;
2929import { Editor } from '@tiptap/react' ;
3030import { usePrevious } from '@uidotdev/usehooks' ;
3131import { decode } from 'html-entities' ;
@@ -64,6 +64,7 @@ interface PropertyProps {
6464 controlPath ?: string ;
6565 customClassName ?: string ;
6666 deletePropertyButton ?: ReactNode ;
67+ displayConditionsQuery ?: UseQueryResult < GetWorkflowNodeParameterDisplayConditions200Response , Error > ;
6768 formState ?: FormState < FieldValues > ;
6869 objectName ?: string ;
6970 operationName ?: string ;
@@ -81,6 +82,7 @@ const Property = ({
8182 controlPath = 'parameters' ,
8283 customClassName,
8384 deletePropertyButton,
85+ displayConditionsQuery,
8486 formState,
8587 objectName,
8688 operationName,
@@ -114,7 +116,7 @@ const Property = ({
114116 const [ showInputTypeSwitchButton , setShowInputTypeSwitchButton ] = useState (
115117 ( property . type !== 'STRING' && property . expressionEnabled ) || false
116118 ) ;
117- const [ isFetchingCurrentDisplayCondition , setIsFetchingCurrentDisplayCondition ] = useState ( false ) ;
119+ const [ isFetchingCurrentDisplayCondition , setIsFetchingCurrentDisplayCondition ] = useState ( true ) ;
118120
119121 const editorRef = useRef < Editor > ( null ) ;
120122 const inputRef = useRef < HTMLInputElement > ( null ) ;
@@ -125,14 +127,11 @@ const Property = ({
125127 const { setDataPillPanelOpen} = useDataPillPanelStore ( ) ;
126128 const { workflow} = useWorkflowDataStore ( ) ;
127129
128- const { isFetchedAfterMount : isDisplayConditionFetched } = useGetWorkflowNodeParameterDisplayConditionsQuery (
129- {
130- id : workflow . id ! ,
131- // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
132- workflowNodeName : currentNode ?. workflowNodeName ! ,
133- } ,
134- ! ! currentNode ?. workflowNodeName
135- ) ;
130+ const { isFetchedAfterMount : isDisplayConditionsFetched , isPending : isDisplayConditionsPending } =
131+ displayConditionsQuery ?? {
132+ isFetchedAfterMount : false ,
133+ isPending : false ,
134+ } ;
136135
137136 const previousOperationName = usePrevious ( currentNode ?. operationName ) ;
138137
@@ -433,39 +432,51 @@ const Property = ({
433432 } ) ;
434433 } ;
435434
436- const handleSelectChange = ( value : string , name : string ) => {
437- if ( ! currentComponent || ! workflow . id || ! name || ! path || ! updateWorkflowNodeParameterMutation ) {
438- return ;
439- }
435+ const handleSelectChange = useCallback (
436+ ( value : string , name : string ) => {
437+ if ( ! currentComponent || ! workflow . id || ! name || ! path || ! updateWorkflowNodeParameterMutation ) {
438+ return ;
439+ }
440440
441- if ( value === propertyParameterValue ) {
442- return ;
443- }
441+ if ( value === propertyParameterValue ) {
442+ return ;
443+ }
444444
445- setSelectValue ( value ) ;
446- setPropertyParameterValue ( value ) ;
445+ setSelectValue ( value ) ;
446+ setPropertyParameterValue ( value ) ;
447447
448- let actualValue : boolean | null | number | string = type === 'BOOLEAN' ? value === 'true' : value ;
448+ let actualValue : boolean | null | number | string = type === 'BOOLEAN' ? value === 'true' : value ;
449449
450- if ( type === 'INTEGER' && ! mentionInputValue . startsWith ( '${' ) ) {
451- actualValue = parseInt ( value ) ;
452- } else if ( type === 'NUMBER' && ! mentionInputValue . startsWith ( '${' ) ) {
453- actualValue = parseFloat ( value ) ;
454- }
450+ if ( type === 'INTEGER' && ! mentionInputValue . startsWith ( '${' ) ) {
451+ actualValue = parseInt ( value ) ;
452+ } else if ( type === 'NUMBER' && ! mentionInputValue . startsWith ( '${' ) ) {
453+ actualValue = parseFloat ( value ) ;
454+ }
455455
456- if ( value === 'null' || value === '' ) {
457- actualValue = null ;
458- }
456+ if ( value === 'null' || value === '' ) {
457+ actualValue = null ;
458+ }
459459
460- saveProperty ( {
461- includeInMetadata : custom ,
460+ saveProperty ( {
461+ includeInMetadata : custom ,
462+ path,
463+ type,
464+ updateWorkflowNodeParameterMutation,
465+ value : actualValue ,
466+ workflowId : workflow . id ,
467+ } ) ;
468+ } ,
469+ [
470+ currentComponent ,
471+ custom ,
472+ mentionInputValue ,
462473 path ,
474+ propertyParameterValue ,
463475 type ,
464476 updateWorkflowNodeParameterMutation ,
465- value : actualValue ,
466- workflowId : workflow . id ,
467- } ) ;
468- } ;
477+ workflow . id ,
478+ ]
479+ ) ;
469480
470481 const memoizedWorkflowTask = useMemo ( ( ) => {
471482 return [ ...( workflow . triggers ?? [ ] ) , ...( workflow . tasks ?? [ ] ) ] . find (
@@ -758,24 +769,30 @@ const Property = ({
758769 if ( displayCondition && currentComponent ?. displayConditions ?. [ displayCondition ] ) {
759770 setIsFetchingCurrentDisplayCondition ( true ) ;
760771
761- if ( isDisplayConditionFetched ) {
772+ if ( isDisplayConditionsFetched ) {
762773 setIsFetchingCurrentDisplayCondition ( false ) ;
763774 }
764775 }
765- } , [ displayCondition , currentComponent ?. displayConditions , isDisplayConditionFetched ] ) ;
776+ } , [ displayCondition , currentComponent ?. displayConditions , isDisplayConditionsFetched ] ) ;
766777
767778 if ( hidden ) {
768779 return < > </ > ;
769780 }
770781
771- if ( displayCondition && ! currentComponent ?. displayConditions ?. [ displayCondition ] ) {
772- return < > </ > ;
782+ if ( displayCondition && isDisplayConditionsPending && type !== 'ARRAY' && type !== 'OBJECT' ) {
783+ return (
784+ < div className = { twMerge ( 'flex flex-col space-y-1' , objectName && 'ml-2 mt-1' ) } >
785+ < Skeleton className = "h-5 w-1/4" />
786+
787+ < Skeleton className = "h-9 w-full" />
788+ </ div >
789+ ) ;
773790 }
774791
775792 if (
776793 displayCondition &&
777794 currentComponent ?. displayConditions ?. [ displayCondition ] &&
778- isFetchingCurrentDisplayCondition &&
795+ ( isFetchingCurrentDisplayCondition || isDisplayConditionsPending ) &&
779796 type !== 'ARRAY' &&
780797 type !== 'OBJECT'
781798 ) {
@@ -788,6 +805,10 @@ const Property = ({
788805 ) ;
789806 }
790807
808+ if ( displayCondition && ! currentComponent ?. displayConditions ?. [ displayCondition ] ) {
809+ return < > </ > ;
810+ }
811+
791812 return (
792813 < li
793814 className = { twMerge (
0 commit comments