Firebase raw query not playing nicely with additionalScope data

  • Goal:

I am trying to pass a variable using additionalScope to a firebase raw query.
In the firebase raw code I need to apply modifications to that object to support e.g. to use GeoPoint.
When simply passing the object everything works, but as soon as i try to:

  • assign a property a value using GeoPoint class instance
  • Spread the object
  • stringify/parse the object

its getting very weird, where all properties of the object are getting removed. See screenshots.

  • Steps:
  1. Create a firebase raw mode query
  2. Expect an additionalScope variable name, something like updatedData
  3. From a JS query code call your firebase query and pass updatedData { myValue: 'test' }
  4. In your firebase raw query, try to add a new property such as:
updatedData.newProperty = new firebase.GeoPoint(0,0)
  1. Return the updatedData variable
  2. In a success handler / transformer try to log the data result of your query
  3. Notice how your myValue property got removed
  • Details:

    • Retool version 3.85.0
  • Screenshots:

Here I am just printing the data, works:

Here I just add a primitive property, still works:

Here I try to assign the GeoPoint property and this is where stuff gets weird:

Notice how suddenly there are only 2 properties on the object: what and location. I expected all properties to be present. Also its beyond my understand why there is suddenly a new property called location, maybe because it was accessed earlier?

app.json (150.4 KB)

  • Additional note (only read this if you're from the retool team, its just me ranting):

There were so many weirdness in the firebase raw mode, for example i tried to use the spread operator, which also somehow removed all properties, or tried to use the Object.assign() method which also yielded weird results. Using retool in the beginning was a thrill but the more i discover some weird places where i can't properly use JS due to some blackbox magic of passing data in between different services the more frustrating it gets. Sorry, i know this is probably not the right place to blow some steam off, but this thing just stole so much time and i wish retool to be the perfect tool!

Ah yeah, also just writing updatedData.what = 1 gives a new error of undefined variable updatedData - hyper weird!

1 Like

Hello @hannojg!

Sorry for the difficulty with Firebase raw queries, we would love to help implement your feedback to improve things.

I just spun up a demo app and was losing the object properties I had been adding, inside my JS Query, when returning that same additional scope object with a GeoPoint added on as a property in a Firebase Raw query :melting_face: so there is definitely something weird going on.

When I hard coded in my latitude and longitude (As you assign on line 14 and 15) the other properties were found.... very odd. I am filing a bug report to our engineering team to take a look at right now!

Will keep you posted on what we hear from the team :saluting_face: