-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Return callables from callables in Deephaven UI #540
Conversation
plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py
Outdated
Show resolved
Hide resolved
plugins/ui/src/deephaven/ui/object_types/ElementMessageStream.py
Outdated
Show resolved
Hide resolved
// Do NOT add anything that logs result | ||
// It creates a strong ref to the result object in the console logs | ||
// As a result, any returned callables will never be GC'd and the finalization registry will never clean them up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love a little blog post about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya not sure what else would be covered in a blog post. Guess it could be on weakrefs in general
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WeakRef, FinalizationRegistry, garbage collection - would be short and interesting
Fixes #322. Will be required for full completion of #321.
Currently a little hard to test, but this should demonstrate it if you watch the JS debug logs on
WidgetHandler
.Run this Python code.
Normal
button should behave the same as latest dh.ui.Nested
button will return a callable as the direct result of the callback function. This should allow us to doconst fn = await callable(args);
basically. It is not called, but there is a log fromWidgetHandler
after 5-10s that it was cleaned up. Or you can use theMemory
tab in dev tools and click the broom icon to trigger a manual GC.Double Nested
button will return and wrap an object containing a new callable. You can filter the browser logs forWidgetUtils
and look forcallable ID result string
which won't have the parsed function, but will contain the object representing it as well as the other parts of the returned object.Not serializable
button will basically do nothing except log an error in the Python console. The returned result will include that it was a serialization error to JS, but we do nothing with it.