I've got an async JS query that returns an array as expected (just an array of customer names).
The query is triggered on pageview event.
Those names are meant to be the options for a customer-lookup select field. When previewing the app in browser it seems to work fine.
But using it on my iPhone, the dropdown simply never populates. I feel like it has something to do with the query being async but I was under the impression that the field would update whenever the data changes, so wouldn't matter how long the query takes.
return (async () => {
let { results, next } = await getAllClients.trigger(); // This makes the initial DB call, returns an array of names in 'results' and a 'next' property, which is the url for the next page of results or 'null' if none
let array = results;
let clientNames = [];
async function getNextPage(url) { // if 'next' url exists, retrieve next page of results and concat to first set of results
let response = await fetch(nextURL, {
headers: {
Authorization: "Token mySecretTokenHere",
},
});
let {results, next} = await response.json();
array = array.concat(results);
if (next !== null) {
getNextPage(next);
} else {
return array;
}
}
if (next != null) {
array = await getNextPage(next);
}
array.map(({ Client }) => {
clientNames.push(Client);
});
return clientNames;
})();
My select field is simply set to be the data result from that query:
Anybody got any ideas why it'd work fine in browser preview but not in mobile?