webR: synchronous metadata.rds probe re-runs on every app start and 404s
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- frontend, performance
Research direction
Start in src/hooks/useWebR.tsx:274-287 at .mount_vfs_images() and trace how metadata_url and the probe result are used during app startup. Check the examples smoke test from #236 while switching examples to confirm the request is not repeated, that the fallback still works for a 404, and that startup is no longer blocked by the synchronous probe.
Written by the indexing model from the issue text.
Description
What
Every R app start fires a synchronous HEAD request for shinylive/webr/packages/metadata.rds, which 404s on shinylive's own build. Found while building the examples smoke test (#236) — it shows up once per R example in the CI logs:
[WebServer] "HEAD /r/shinylive/webr/packages/metadata.rds HTTP/1.1" 404 -
Where
src/hooks/useWebR.tsx:274-287, in .mount_vfs_images():
found <- webr::eval_js(glue::glue("
var xhr = new XMLHttpRequest();
xhr.open('HEAD', '{metadata_url}', false);
xhr.send();
(xhr.status >= 200 && xhr.status < 300)
"))
Why this isn't just log noise
The 404 itself is by design — the comment says as much ("Attempt this download quietly, if no metadata exists we can still continue"), and the fallback works correctly. Two things still look worth a second look:
-
The XHR is synchronous (
xhr.open(..., false)), so it blocks the webR worker thread for a full network round trip during app startup. -
It re-probes on every app start, not once per session. Measured in a warm session by counting requests while switching examples:
after boot + first app: 1 after switching to Shiny Text: 2 after switching to Reactivity: 3 after switching to Sliders: 4The result cannot change within a session, so runs 2..n are pure overhead on a path users wait on.
metadata.rds is presumably present in deployments that ship prebuilt VFS package images; it is absent from the build this repo produces, so shinylive.io pays the miss every time.
Suggested fix
Cache the probe result for the lifetime of the session, and make the request async if the surrounding code allows it. If metadata.rds is never expected in this repo's own build, skipping the probe unless something opts in would avoid it entirely.
Not blocking anything
webR swallows the 404 without raising a console error, so it does not fail the new smoke test and no example is broken by it. Filing separately per discussion on #236.
- Dominant language
- TypeScript
- Stars
- 253
- Forks
- 25
- Avg merge
- 6d 22h
- Merged PRs (30d)
- 13
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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/shinylive
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
dependencies enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 40/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
posit-dev/shinylive#221 · 8 comments · 2 reactions ·
Maintainers usually reply within 1 day
All issues in posit-dev/shinylive
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Vessel9817/onion-site-template#512 ·
Maintainers usually reply within 1 day
-
nightly-tests
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
Maintainers usually reply within 1 day
-
approved
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
fritzprix/libr-agent#3266 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
better-auth/better-auth#13101 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day