Hi there, a "Create" query on my app is triggering when i update the form for no apparent reason.
As you can see in these screenshots I have no event handlers set up on the text input or the form, but I am still seeing this CreateRecommendation query getting triggered every time I update. The stack trace in the debugger indicates that this request is being triggered by "user interaction" in the text field.
Could I please have some help understanding what is causing this?
Yes, that script does call CreateCommendation (conditionally), but I do not believe that is what is causing this. I tried adding a console.log("SUBMIT FORM") line at the top of this script and do not see that log at all while typing into the text field.
Looking again, I think the error isn't being triggered by an unexpected query submit, but instead by an attempt to update the query's changeset behind the scenes as the form data changes. I am passing through that recommendationId manually from the submit script. Maybe there's a better way to denote update parameters as "manual only"?
For visibility, here's the contents of that submit script - maybe there's a more "retool-y" way to coordinate these relation table writes?
"Looking again, I think the error isn't being triggered by an unexpected query submit, but instead by an attempt to update the query's changeset behind the scenes as the form data changes"
In this case, setting the query to run only when Manually Triggered would be your best bet! Though it looks like your query is already set to that. Are you watching any inputs by any chance?
In your code, CreateRecommendation is getting triggered when !!recommendationId is false. Is that the only place that your Submit Script is triggering CreateRecommendation? Strange that "SUBMIT FORM" only console logs once, but CreateRecommendation gets triggered so many times
We are watching a few inputs, but nothing that would trigger the query.
I was able to very easily reproduce this bug(?) in a test app with a single text input and a single query that uses both the value of that text input and a parameter meant to be provided manually. Every time I change the test in the input, a similar error triggers.
The issue almost certainly seems to lie in the internals of the query managing its changeset, but not knowing what to do with the manual parameter. If you guys just added a better way to handle those manual parameters in GUI mode (either outside of the changeset or with a flag of some sort?) I think this wouldn't be an issue anymore. You'd get the added benefit of those parameters not showing up as errors in the query editor.
even just some special internal function like useManualParameter("email") that we could use in the query definition instead of the bare {{ email }} reference might work with barely any effort?