Skip to content

problem with ComponentRegistry and late imports #514

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

Open
T4rk1n opened this issue Dec 26, 2018 · 2 comments
Open

problem with ComponentRegistry and late imports #514

T4rk1n opened this issue Dec 26, 2018 · 2 comments
Labels
bug something broken P3 backlog

Comments

@T4rk1n
Copy link
Contributor

T4rk1n commented Dec 26, 2018

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.

https://github.com/T4rk1n/pytest-dash/issues/15

@T4rk1n T4rk1n added the bug label Dec 26, 2018
@T4rk1n T4rk1n self-assigned this Dec 26, 2018
@T4rk1n
Copy link
Contributor Author

T4rk1n commented Dec 26, 2018

Removing the cache (26cd760) fixed https://github.com/T4rk1n/pytest-dash/issues/15, but late imports in callbacks still fails, they would need to be loaded on demand since they were not included on the index and the callback did not fire yet.

@T4rk1n T4rk1n removed their assignment Jan 23, 2019
@T4rk1n
Copy link
Contributor Author

T4rk1n commented Jan 23, 2019

Unassigned as I have not found a solution for this yet and T4rk1n/pytest-dash#15 is resolved by #524.

@gvwilson gvwilson self-assigned this Jul 17, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added bug something broken P3 backlog and removed dash-type-bug labels Aug 13, 2024
@gvwilson gvwilson changed the title ComponentRegistry and late imports. problem with ComponentRegistry and late imports Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

2 participants