- 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:
- Create a firebase raw mode query
- Expect an additionalScope variable name, something like
updatedData
- From a JS query code call your firebase query and pass updatedData
{ myValue: 'test' }
- In your firebase raw query, try to add a new property such as:
updatedData.newProperty = new firebase.GeoPoint(0,0)
- Return the
updatedData
variable - In a success handler / transformer try to log the data result of your query
- 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 export: (here's how to get a json export)
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!