@@ -123,10 +123,9 @@ export function generateFlowSourceCode(
123123 if ( ! val ) return isForInference ? `/* @pos ${ nodeId } ${ paramIdx } */ {}` : `/* @pos ${ nodeId } ${ paramIdx } */ undefined` ;
124124 if ( val . __typename === "ReferenceValue" ) {
125125 const ref = val as ReferenceValue ;
126- if ( ! ref . nodeFunctionId ) return `/* @pos ${ nodeId } ${ paramIdx } */ undefined` ;
127126 let refCode = typeof ref . inputIndex === "number"
128- ? `p_${ sanitizeId ( ref . nodeFunctionId ) } _${ ref . parameterIndex } [${ ref . inputIndex } ]`
129- : `node_${ sanitizeId ( ref . nodeFunctionId ) } ` ;
127+ ? `p_${ sanitizeId ( ref . nodeFunctionId ?? "undefined" ) } _${ ref . parameterIndex } [${ ref . inputIndex } ]`
128+ : ref . nodeFunctionId ? `node_${ sanitizeId ( ref . nodeFunctionId ) } ` : `flow_ ${ sanitizeId ( flow ?. id ?? "undefined" ) } `;
130129 ref . referencePath ?. forEach ( pathObj => {
131130 refCode += `?.${ pathObj . path } ` ;
132131 } ) ;
@@ -173,10 +172,9 @@ export function generateFlowSourceCode(
173172 if ( ! val ) return isForInference ? `/* @pos ${ nodeId } ${ index } */ {}` : `/* @pos ${ nodeId } ${ index } */ undefined` ;
174173 if ( val . __typename === "ReferenceValue" ) {
175174 const ref = val as ReferenceValue ;
176- if ( ! ref . nodeFunctionId ) return `/* @pos ${ nodeId } ${ index } */ undefined` ;
177175 let refCode = typeof ref . inputIndex === "number"
178- ? `p_${ sanitizeId ( ref . nodeFunctionId ) } _${ ref . parameterIndex } [${ ref . inputIndex } ]`
179- : `node_${ sanitizeId ( ref . nodeFunctionId ) } ` ;
176+ ? `p_${ sanitizeId ( ref . nodeFunctionId ?? "undefined" ) } _${ ref . parameterIndex } [${ ref . inputIndex } ]`
177+ : ref . nodeFunctionId ? `node_${ sanitizeId ( ref . nodeFunctionId ) } ` : `flow_ ${ sanitizeId ( flow ?. id ?? "undefined" ) } `;
180178 ref . referencePath ?. forEach ( pathObj => {
181179 refCode += `?.${ pathObj . path } ` ;
182180 } ) ;
0 commit comments