Using data slots for firebase path and condition sometimes yields empty table


I’m using a couple of data slots

ds_topic_items = ‘/items/foree/contents’
ds_topic_name = ‘doc1’

used to configure firebase table like this…

collection id = $slot(‘ds_topic_items’)

so when the user clicks a navigation item it triggers a script…

this.props.appActions.updateDataSlot(‘ds_topic_name’, ‘new-name’ );
this.props.appActions.updateDataSlot(‘ds_topic_items’, ‘/some/new/path’ );

RS triggers two calls to loadData_firebase1(), once for each slot update
which is not a problem since the data is locally cached

sometimes, the table is not populated as it should be.

sometimes “things” get out of sync
in this example,
the name has changed first (red) and table length === 0 is expected.
then the path is updated (green) and table length should be > 0, but is not

so temporary fix is to hack


such that the firebase query (this.loadData_firebase1)
…only runs once, after the name is updated,
…by ensuring that in my script, the name variable used in the where condition is updated AFTER the path variable.

is there any way to update both of these slots in one go?
is there a way I can persist the hack to App.js across “open in browser/export to react” events?


Hmm. this is a b it tricky. What if you update the Data slot values directly to Data slot array?

I mean something like:

this.props.appActions.dataSlots(“dataslotname”) = “new value”

and use the this.props.appActions.updateDataSlot() for the last Data slot you need to update which then triggers the refresh?