problem with ComponentRegistry and late imports
Open
Nobody has claimed this yet.
bug
P3
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Late imports of components libraries are not served on the index if the app has already started.
Example
import dash
import dash_html_components as html
from dash.exceptions import PreventUpdate
from dash.dependencies import Output, Input
app = dash.Dash(__name__)
app.layout = html.Div([
html.Button('click', id='click'),
html.Div(id='output')
])
@app.callback(Output('output', 'children'), [Input('click', 'n_clicks')])
def on_click(n_clicks):
if n_clicks is None:
raise PreventUpdate
import dash_core_components as dcc
return dcc.Input(id='input', value='my-value')
if __name__ == '__main__':
app.run_server(debug=True, port=8051)
The button will not be inserted and the console show error:
Error: dash_core_components was not found.
Contributor guide
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.
Research direction
Start at ComponentRegistry and the index-serving path, then reproduce the provided callback example with a late import of dash_core_components. Done means the dynamically returned component is served after the app starts and the button inserts it without the “dash_core_components was not found” error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100