ipywidgets
ipywidgets copied to clipboard
Change Promises to Async/Await
Some were simple and some were not
This is a replacement to https://github.com/jupyter-widgets/ipywidgets/pull/2779
I wonder what this means for performance (having skimmed over https://v8.dev/blog/fast-async ). I might do a comparison before/after to see if it does matter.
Having some trouble figuring out what to do about the failing checks. Particularly I can't replicate the Error: src/widget.ts(289,5): error TS2322: Type 'Dict<unknown>' is not assignable to type 'Dict<BufferJSON>'. on my local machine when I run ./dev-install.sh or a clean/build.
The build error is happening in a method I refactored out of _handle_comm_msg. It's nearly a copy and paste of the original promise callback function. Any advice is welcome.
@jmk89 This is due to the change in the this context. I will add a suggestion shortly
@jmk89 Here is a commit I added last week to fix the issue of not compiling: https://github.com/ibdafna/ipywidgets/pull/1/commits/c4f468eaa2714d4061b7c986fb888e712022700d
As an update, we discussed this in the ipywidgets dev meeting, and a few of us will have more time to look at this next week during the widgets dev workshop. Thanks!
@jmk89 I am happy to push the fix above, directly to this branch, with your permission! 🙏
@ibdafna sounds good to me, thanks for asking 😄 . Although I'm not fully understanding the fix 😅 - it seems to me like setting the state_change to the awaited state_change breaks the "chain of state change" which was being queued.
It's quite likely that I'm misunderstanding, if there's any enlightenment you can forward my way I'd appreciate it 😄