[bug] modifying dataclass function, reloading event in form causes it to mistakenly add an extra parameter

Hello Mikey,

Did you, by any chance, before adding the params to you function, click on the “add parameter” button?
image

i did not. all i hit was the refresh button.
i recreated the recipe so i could take screenshots of it.

Hello Mikey,

The third parameter appears to have been added using the “Add parameter” button before hitting the refresh button, as only manually added parameters have a delete option. Code-defined parameters need to be deleted from the code and then refresh the function prototype.

For more clarity, when working with function bindings, consider two scenarios:

  1. Automatic Parsing:

    • Initially, upon binding a function, Qodly Studio automatically interprets its prototype and parameters.

    • Modifying the function prototype in the code by removing all parameters and clicking the refresh button, updates the prototype accordingly, showing no parameters.

  2. Manual Parameter Addition:

    • Starting with a parameter-less function, manually adding a parameter using the “Add parameter” button, and then updating the code to integrate one parameter results in the manually added parameter assuming the role of the parameter in the function code.

    • However, refreshing the function prototype prioritizes code-defined parameters. The one added in the code is automatically included, while preserving the manually added one below it. (This is why, in your case, there are three parameters instead of two.)

Best regards,

see comment above yours.
i did not add a parameter. all i hit was the refresh button. i tried it twice, so i could repeat the recipe and take screenshots.

Hello Mikey,

In the second screenshot you shared, the event showed the existing parameter affecting the datasource locationsCollection even before the refresh.

The manual addition is highlighted by the delete icon. Removing Code-defined parameters directly from the webform editor is not possible.

To fix this, delete the parameter using the delete button next to it. If you bind the same function a second time, it will lack that parameter, containing only the Code-defined parameters c and l.

Best regards,

since it’s been a couple of weeks, and i barely remember this issue, are you saying that the screenshot at the bottom of the first post was taken out of sequence, and that i had futzed up the function bind, along the way? i’m just trying to understand what you’re saying.
i thought i took all of these right in a row, when i was repeating the recipe. the timestamps on them seem to say that they were taken in order, but i don’t know how those timestamps were generated, and since it has been a couple of weeks, i don’t remember what else might have happened.

Hello Mikey,

My explanation relies on the sequential order of the screenshots, which are accurate. They suggest the following scenario:

  1. Bound a parameter-less function to an event.
  2. Manually added a parameter using the Add parameter button.
  3. Updated the code to integrate two Code-defined parameters, c and l.
  4. Refreshed the function prototype to include those Code-defined parameters.
  5. Consequently, the function prototype prioritized the two Code-defined parameters, followed by the manually added one, resulting in three parameters instead of two in your case.

Regardless of how much you refresh the function prototype, you’ll need to manually delete the added parameter, just like how it was added.

Best regards,

so, you think that what is missing is a photo of step 2 in your scenario, right?

Indeed, that’s the missing element in the scenario you outlined. It may have eluded your attention, or perhaps it was a bug or an error that has since been rectified; I’m not entirely certain.

1 Like