Some ipywidgets never show up in Positron notebooks
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- jupyter, python, typescript
- Domain
- backend-api-design, frontend
Research direction
The issue points to two paths: output webview sizing after MutationObserver changes, and widget state requests handled by the IPyWidgets service. Start by locating the injected sizing script and the service's request_states and comm_info_request handling, then reproduce each Python example in a notebook. Done means both widgets appear by the time the cell finishes; also check whether the sizing change affects Quarto inline output.
Written by the indexing model from the issue text.
Description
I dug into some empty widget outputs in Positron notebooks while reviewing #17283, and found two separate bugs. Both reproduce on main. 🤖 follows:
1. An Output that gets content after it's displayed stays empty.
# cell 1
import ipywidgets as w
from IPython.display import display
out = w.Output()
display(out)
# cell 2
with out:
print("written from a later cell")
Cell 1 never shows the text. The text does get rendered into the output's webview, but the webview is about 2px tall and never grows. The script we inject into output webviews to report their height waits for a requestAnimationFrame before sending the size, and in a frame that small the callback never runs. (I checked: a MutationObserver in that frame fires right away, but a requestAnimationFrame callback never does.) So once an output gets measured as nearly empty, nothing after that resizes it.
Widgets that render all at once, like a slider, aren't affected. Output content always renders a little late, since each item round-trips to the main thread to pick a renderer, so it hits this every time.
When I changed the script to send the size straight from the MutationObserver callback, Output content showed up, including the capture-before-display cases from #17283. I haven't checked what else that change touches though; the same script runs in every notebook output webview, and Quarto inline output uses the same size messages.
2. A widget displayed while its cell is still running never renders.
import ipywidgets as w, time
from IPython.display import display
display(w.IntSlider(7))
time.sleep(8)
The same slider without the sleep renders fine.
When the output's webview opens, the widget manager asks the kernel for the widget state with a request_states comm message. The kernel can't answer that while the cell is still running, so it times out after 5 seconds:
Error: RPC timed out after 5 seconds: {"method":"request_states"}
The ipywidgets base manager then falls back to a comm_info_request, which our IPyWidgets service doesn't handle, so the render just hangs for good, even after the cell finishes. This also breaks the "display an Output, then write to it while doing slow work" pattern. I haven't checked whether the console has the same problem.
In both cases the widget should show up, at the latest once the cell finishes.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 207
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 308
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from posit-dev/positron
-
area: assistant area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
accessibility area: plots area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: plots area: ui bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: kernels lang: r
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
posit-dev/positron#17575 · 2 comments ·
Maintainers usually reply within 1 day
-
Memory meter counts page cache as used memory under a cgroup limitPossibly taken @jmcphers claimed this 10 days ago. Openarea: workbench bug memory-use support
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
posit-dev/positron#17414 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in posit-dev/positron
Similar issues
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
novuhq/novu#13613 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement from-app needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nightly-labs/openbot#23943 ·
Maintainers usually reply within 1 day
-
comp/desktop desktop/chat P3 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
NousResearch/hermes-agent#164451 ·
Maintainers usually reply within 1 day
-
shortkeys-2188:ready
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
crittermike/shortkeys#1121 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Doist/todoist-cli#742 ·