When running the following code we get null
logged:
const val = 1;
ts.setValue(val);
console.log('ts value is');
console.log(ts.value);
Is this the expected behavior? If so, how might we accomplish the following:
- When the page loads, we need to get the current time and save it in a var
- This time var will be used in queries throughout the page
- Some of those queries run immediately on pageload....but they fail sometimes, because the temporary state time var does not yet exist (as seen above, it's null for some milliseconds after setting it)
Hi @aviator22!
You can try setting the initial value of your temporary state value which will make it more immediately accessible.

As to the expected behavior - this question was brought up by @bradlymathews here. To summarize: ts.setValue
returns a promise which you can await
and then reference the new value with ts.value
if you go to the 'Advanced' tab of your query and select this option:
Let me know if this works out for you!
3 Likes
Thanks folks, that clears it up
This doesn't seems like working when you import the app as module and run from parent app. Is it by design or a bug?
Tracking this bug here! Thanks for surfacing it 