Skip to content

Need async metadata support when generating R versions of component libraries #1002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rpkyle opened this issue Nov 6, 2019 · 1 comment · Fixed by #1048
Closed

Need async metadata support when generating R versions of component libraries #1002

rpkyle opened this issue Nov 6, 2019 · 1 comment · Fixed by #1048
Assignees
Labels
performance something is slow
Milestone

Comments

@rpkyle
Copy link
Contributor

rpkyle commented Nov 6, 2019

Currently, Dash for Python leverages __init__.py to identify whether a package has resources which should be loaded asynchronously, e.g.

https://github.com/plotly/dash-core-components/blob/0e1449813c620adfd337568cee8cc55292d76c02/dash_core_components_base/__init__.py#L42-L48

In Dash for R, the internal.R script provides much of the same information, but currently lacks metadata related to async resources:

https://github.com/plotly/dash-core-components/blob/master/R/internal.R

The package generator should be modified to insert the requisite details about async resources when appropriate.

@Marc-Andre-Rivet @alexcjohnson

@rpkyle rpkyle self-assigned this Nov 6, 2019
@rpkyle rpkyle added this to the Dash v1.7 milestone Nov 6, 2019
@alexcjohnson
Copy link
Collaborator

related comment I made a few days ago: plotly/dash-bio#430 (comment)

Not for this PR, but at some point - like perhaps, whenever we get around to fully generating __init__.py - this all seems ripe for abstracting into the dash core, like

_js_dist = _dash.development.list_resources(
    ['bundle.js'],
    ['async~{}.js'.format(resource) for resource in async_resources],
    external_prefix='https://unpkg.com/dash-bio@{}/dash_bio'.format(__version__)
)

May still need some tweaking to handle edge cases like async: 'eager'|'lazy', but we should at least be able to auto-detect sourcemaps (which may not exist in release versions #910) and set them all dynamic: True regardless of the resource setting.

Feels like the end goal is that the metadata just has a list of async_resources - maybe by extension it also has a list of resources (sync), as well as dynamic_resources, eager_resources, and lazy_resources?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance something is slow
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants