Query Triggering For No Apparent Reason

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?

Hey @ecookie! Happy to help with this. Is this the event handler that's triggering the CreateRecommendation query, by any chance?

Hi, thank you for looking!

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?

console.log("SUBMIT FORM")

const currRec = RecommendationTable.selectedRow;

let recommendationId;
let needIds = [];

if (!!currRec) {
  recommendationId = currRec.id;
  needIds = currRec.needs.map(n => n.id);

if (!!recommendationId) {
  await UpdateRecommendation.trigger();
} else {
  recommendationId = uuid.v4();
  await CreateRecommendation.trigger({
    additionalScope: {

const selectedNeedIds = RecommendationForm.data.needIds;

const deleteNeedIds = _.difference(needIds, selectedNeedIds);
if (deleteNeedIds.length > 0) {
    additionalScope: {
      needIds: deleteNeedIds

const addNeedIds = _.difference(selectedNeedIds, needIds);
const newJoins = addNeedIds.map(needId => ({
  recommendation_id: recommendationId,
  need_id: needId,
if (addNeedIds.length > 0) {
    additionalScope: { newJoins }

await FetchRecommendations.trigger();

  key: recommendationId 
"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 :thinking:

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?