Skip to content

Add widgetDependencies() S3 generic#255

Open
cpsievert wants to merge 2 commits into
ramnathv:masterfrom
cpsievert:carson/feature/getDependency
Open

Add widgetDependencies() S3 generic#255
cpsievert wants to merge 2 commits into
ramnathv:masterfrom
cpsievert:carson/feature/getDependency

Conversation

@cpsievert
Copy link
Copy Markdown
Collaborator

@cpsievert cpsievert commented Jan 18, 2017

Summary

  • Adds widgetDependencies() as a public S3 generic with character and htmlwidget methods
  • The htmlwidget method returns all dependencies (YAML-declared + JS binding + runtime dependencies slot), fixing under-reporting when deps are added dynamically via createWidget(dependencies = ...)
  • toHTML() and shinyRenderWidget() now use widgetDependencies(x) as the single canonical path for resolving widget dependencies
  • getDependency() is preserved as a deprecated internal alias

Motivation

Previously there was no public API to get the complete set of HTML dependencies from a widget object. getDependency(name, package) only returned the YAML + binding deps, missing any runtime dependencies added under the dependencies slot. This made it difficult for downstream code to introspect widget dependencies accurately.

Breaking changes

  • getDependency() now emits a deprecation warning directing users to widgetDependencies()
  • The first argument is now named x (positional callers are unaffected)

@ramnathv
Copy link
Copy Markdown
Owner

This looks good @cpsievert. Let me test through a couple of scenarios before I merge it in.

widgetDependencies() is a public S3 generic with character and htmlwidget
methods. The htmlwidget method returns all dependencies (YAML + binding +
runtime), fixing under-reporting when deps are added via createWidget().

Internally, toHTML() and shinyRenderWidget() now use widgetDependencies(x)
as the single canonical path for resolving widget dependencies.
@cpsievert cpsievert force-pushed the carson/feature/getDependency branch from d83dd5b to f247f62 Compare May 5, 2026 16:26
@cpsievert cpsievert changed the title Get dependencies from an htmlwidget object Add widgetDependencies() S3 generic May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants