I’m facing an intermittent issue where app.subDesigns
remains undefined
even after calling BF.namedAction('loadDesigns')
.
The odd thing is:
I can see subDesigns
populated in the dev tools, which means that loadDesigns
did complete and returned data, but in js, it stays undefined
or empty** at runtime.
Here’s the polling logic I’m using to wait for it:
BF.namedAction(‘loadDesigns’);
(async () => {
let maxTries = 500;
let interval = 200;
while ((!app.subDesigns || app.subDesigns.length === 0) && maxTries-- > 0) {
console.log(‘Waiting’);
await new Promise(resolve => setTimeout(resolve, interval));
}
if (app.subDesigns) {
console.log(‘Loaded:’, app.subDesigns);
} else {
console.log(‘Timed out waiting for app.subDesigns’);
}
})();