You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#454 listed three ways to stop maidr.render() hurting a Shiny app. Option 1 (render off the loop, per-figure lock) shipped in #504 and #531, option 3 (document it accurately) shipped in #511, and #454 is now closed on that basis.
Option 2 never happened, and it addresses a different cost. Splitting it out so it is tracked somewhere that is still open — docs/index.qmd currently points a reader at #454 for it, which is a closed issue.
The cost
Every reactive flush pushes the entire rendered chart through the websocket as part of the output payload:
roughly 25 KB per flush on the default use_cdn setting
~1.9 MB per chart with use_cdn=False, because the bundle is inlined into each srcdoc
Measured under the #457 QA with two charts on one page, offline: 3891 KB for the iframe build against 44 KB for an inline one. The gap widens with every chart, since each iframe carries its own copy of the bundle.
This is per flush, not per session. A reader moving a slider pays it again each time.
The shape
session.dynamic_route registers a URL for the duration of a session. The output payload becomes a reference rather than the document, and the browser fetches the chart — cached, out of band, off the websocket.
Worth knowing before anyone starts:
It changes what render_maidr returns, so tests/widget/test_every_door_agrees.py is the contract to keep honest — every door must still ship the same chart.
It interacts with the iframe question in Evaluate rendering Shiny charts inline instead of inside an iframe #457. An inline chart already avoids most of this (44 KB vs 3891 KB) by loading the bundle once per page rather than once per chart; a dynamic route would help both embeddings but is a smaller win for the inline one.
#454 listed three ways to stop
maidr.render()hurting a Shiny app. Option 1 (render off the loop, per-figure lock) shipped in #504 and #531, option 3 (document it accurately) shipped in #511, and #454 is now closed on that basis.Option 2 never happened, and it addresses a different cost. Splitting it out so it is tracked somewhere that is still open —
docs/index.qmdcurrently points a reader at #454 for it, which is a closed issue.The cost
Every reactive flush pushes the entire rendered chart through the websocket as part of the output payload:
use_cdnsettinguse_cdn=False, because the bundle is inlined into eachsrcdocMeasured under the #457 QA with two charts on one page, offline: 3891 KB for the iframe build against 44 KB for an inline one. The gap widens with every chart, since each iframe carries its own copy of the bundle.
This is per flush, not per session. A reader moving a slider pays it again each time.
The shape
session.dynamic_routeregisters a URL for the duration of a session. The output payload becomes a reference rather than the document, and the browser fetches the chart — cached, out of band, off the websocket.Worth knowing before anyone starts:
render_maidrreturns, sotests/widget/test_every_door_agrees.pyis the contract to keep honest — every door must still ship the same chart.use_cdn=Falseweight is the bundle, and use_cdn="auto" has no working offline fallback inside a srcdoc iframe #455 is about giving that an offline path that is not "inline it per chart". Fixing that could shrink this on its own.No measurements of a
dynamic_routeimplementation here — this issue exists so the idea has a home and the docs have something open to point at.Follow-up from #454.