Repository: appsmithorg/appsmith
File: app/client/src/components/propertyControls/TableComputeValue.tsx (TypeScript)

Code before:
    );

    return JSToString(computationExpression);
  };

  getComputedValue = (value: string, tableName: string) => {
    // Return raw value if:
    // 1. The value is not a dynamic binding (not wrapped in {{...}})
    // 2. AND this control is not configured to handle array values via additionalControlData
    // This allows single values to be returned without table binding computation
    if (
      !isDynamicValue(value) &&
      !this.props.additionalControlData?.isArrayValue
    ) {
      return value;
    }

    const stringToEvaluate = stringToJS(value);

    if (stringToEvaluate === "") {
      return stringToEvaluate;
    }

    return ComputeTablePropertyControlV2.getTableComputeBinding(
      tableName,
      stringToEvaluate,
    );
  };

  onTextChange = (event: React.ChangeEvent<HTMLTextAreaElement> | string) => {
    let value = "";

    if (typeof event !== "string") {
      value = event.target?.value;
    } else {
      value = event;
    }

    if (isString(value)) {
      const output = this.getComputedValue(
        value,
        this.props.widgetProperties.widgetName,
      );

      this.updateProperty(this.props.propertyName, output);
    } else {
      this.updateProperty(this.props.propertyName, value);
    }
  };

  static getControlType() {

Review comment (suggestion):
Can the opening structure be :
`(
   () =>
      {` i.e. with new line chars instead of spaces or `(() =>{` ? @jacquesikot 

Code after:
      computationStart,
    );

    // Handle case where no matching closing parenthesis is found
    if (!isValid) {
      // If we can't find the proper closing parenthesis, fall back to returning the original value
      // This prevents errors when the expression is malformed
      return propertyValue;
    }

    // Extract the computation expression between the map parentheses
    const computationExpression = propertyValue.substring(
      computationStart,
      endIndex,
    );

    return JSToString(computationExpression);
  };

  /**
   * Check if the computed value string looks structurally valid
   * This helps catch obviously malformed expressions early
   */
  private static isLikelyValidComputedValue(value: string): boolean {
    // Check for basic structural elements that should be present
    const hasOpeningStructure = value.includes("(() => {");
    const hasTableDataAssignment = value.includes("const tableData =");
    const hasReturnStatement = value.includes("return tableData.length > 0 ?");
    const hasClosingStructure = value.includes("})()}}");

    return (
      hasOpeningStructure &&
      hasTableDataAssignment &&
      hasReturnStatement &&
      hasClosingStructure
    );
  }

  /**
   * Utility function to find the matching closing parenthesis
   * @param text - The text to search in
   * @param startIndex - The index after the opening parenthesis
   * @returns Object containing the index of the matching closing parenthesis and whether it was found
   */
  private static findMatchingClosingParenthesis(
    text: string,
    startIndex: number,
  ) {
    let openParenCount = 1; // Start with 1 for the opening parenthesis

    for (let i = startIndex; i < text.length; i++) {