Skip to content

Commit ce39662

Browse files
pinin4fjordsclaude
andcommitted
Patch htmlwidgets 1.6.4 renderValue to await dep scripts
In htmlwidgets/www/htmlwidgets.js shinyBinding.renderValue calls the synchronous Shiny.renderDependencies(data.deps) and then immediately invokes bindingDef.renderValue — the plugin <script> tag is appended to <head> but not awaited. Locally that's a <1ms race; behind the Seqera Studios iframe + connect-client relay it consistently loses, so e.g. $().DataTable is undefined when the DT binding runs, producing '$table.DataTable is not a function' on any tab with a DataTables widget. Patch the file at image build time to make renderValue async and await renderDependenciesAsync when available, falling back to the sync path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 74dc7cd commit ce39662

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.seqera/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ RUN rm -rf /opt/conda/pkgs/*.lock && \
4141
&& micromamba clean --all --yes \
4242
&& rm -rf /opt/conda/pkgs/*.lock
4343

44+
# ---------------------------------------------------------------
45+
# Workaround: htmlwidgets 1.6.4's Shiny binding calls the synchronous
46+
# Shiny.renderDependencies(data.deps) before bindingDef.renderValue, so
47+
# the widget plugin <script> tag is appended but not awaited. Locally
48+
# that's a <1ms race; behind the Seqera Studios iframe/connect-client
49+
# relay it consistently loses, so e.g. $().DataTable is undefined when
50+
# the DT binding tries to initialise the table. Patch to use the
51+
# async variant and await it.
52+
RUN f=/opt/conda/envs/shinyngs/lib/R/library/htmlwidgets/www/htmlwidgets.js \
53+
&& grep -q 'shinyBinding.renderValue = function(el, data)' "$f" \
54+
&& sed -i \
55+
-e 's|shinyBinding\.renderValue = function(el, data) {|shinyBinding.renderValue = async function(el, data) {|' \
56+
-e 's|Shiny\.renderDependencies(data\.deps);|await (Shiny.renderDependenciesAsync ? Shiny.renderDependenciesAsync(data.deps) : Shiny.renderDependencies(data.deps));|' \
57+
"$f" \
58+
&& grep -n 'await (Shiny.renderDependenciesAsync' "$f"
59+
4460
# Add connect-client version label for Platform capability tracking
4561
ARG CONNECT_CLIENT_VERSION
4662
LABEL io.seqera.connect.version="${CONNECT_CLIENT_VERSION}"

0 commit comments

Comments
 (0)