async menu init working randomly
See original GitHub issueDescribe your goal Fill a select menu dynamically from a async func
Expected This is what I came up with:
//This 2 funcs are methods of a class
//This just returns an array of random strings
private list(ctx) {
return new Promise((resolve, reject) => {
resolve(Array.from(Array(5)).map(x => parseInt(Math.random() * 100).toString()))
})
}
private async getList(ctx) {
let lista = await this.list(ctx)
console.log(list);
return lista
}
//This is inside another method
let self = this
subscribedAccounts.select('unsubscribe-account', self.getList,
{
setFunc: (ctx, key) => {
console.log('hello', key);
},
setParentMenuAfter: true
}
)
This is the output. Weird thing is the list is printed when the menu shows up but already when it hides after clicking on a button. The other weird thing is it only prints “hello number” once after trying several times to show the menu and click an option.
[ '19', '72', '91', '28', '91' ]
[ '92', '36', '27', '8', '61' ]
[ '1', '77', '79', '8', '44' ]
[ '9', '24', '8', '85', '68' ]
[ '93', '44', '70', '84', '45' ]
[ '78', '19', '50', '9', '19' ]
[ '75', '95', '52', '1', '5' ]
[ '5', '74', '62', '27', '59' ]
hello 5
[ '34', '38', '10', '25', '67' ]
[ '30', '40', '81', '55', '67' ]
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Common async / Task mistakes, and how to avoid them
When running the code as-is, everything works fine. The exception is thrown properly, since we await DoStuff(), which in turn means we are ......
Read more >Use Promise.all to Stop Async/Await from Blocking Execution ...
When sending off requests to load third-party data or do other asynchronous work, using a Promise has become a common pattern for telling...
Read more >Problem with getting e.target value from an asynchronous ...
I want to be able to click one of two lists (names and surnames) and then show in the div called 'result' the...
Read more >Asynchronous JavaScript: Introducing async and await - Twilio
This function returns a Promise, which resolves with a randomly generated number after 3 seconds. To delay the output, the code uses the ......
Read more >Random "Unknown interaction" errors sometimes · Issue #7005
Suddenly getting errors (though everything was working fine still). It's not the 3 second rule, I checked and responses was always <1s.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure, I will try to migrate what I have. Thanks for your help!
If you dont have much yet I suggest you should use v5 of the library. Allowing to switch this behavior off as #106 is about will only be added there. Also v5 has some neat improvements.