aicam commented on code in PR #6897:
URL: https://github.com/apache/texera/pull/6897#discussion_r4029742234


##########
frontend/src/app/workspace/component/ui-udf-parameters/ui-udf-parameters.component.ts:
##########
@@ -104,8 +111,17 @@ export class UiUdfParametersComponent extends 
FieldArrayType<FormlyFieldConfig>
     this.configureRowColumns(rowField, this.setDisabledMetadata.bind(this));
   }
 
-  private configureRowFields(rowField: FormlyFieldConfig | undefined): void {
+  private configureRowFields(rowField: FormlyFieldConfig | undefined, 
inputType?: string): void {
     this.configureRowColumns(rowField, this.configureDisabledState.bind(this));
+    this.configureValueEditor(rowField, inputType);
+  }
+
+  /** A row whose value names a resource is edited with that resource's 
browser, not a text box. */
+  private configureValueEditor(rowField: FormlyFieldConfig | undefined, 
inputType?: string): void {
+    const valueField = rowField && this.getColumnField(rowField, VALUE_COLUMN);
+    if (!valueField || !inputType || !RESOURCE_INPUT_TYPES.has(inputType)) 
return;
+    valueField.type = RESOURCE_VALUE_EDITOR;

Review Comment:
   Good catch — it should, and it now does. The issue was broader than the 
guard: Formly keeps each row's field config by index when the parameter list is 
rebuilt from the code, and a cell only re-renders when it's handed a new 
config. So changing type in place never took effect on an existing row, in 
either direction — a row that stopped naming a resource kept the browser, and 
one that gained `value=Resource.X` stayed a text box. The component now records 
which resource each row was configured for, and on rebuild drops a row whose 
resource changed (and the rows after it), so Formly recreates it from the 
template with the right editor; unchanged rows are kept. There's a spec for the 
plain → resource → unchanged → plain sequence, and I checked both directions in 
the running app.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to