Skip to content
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

3.0 RC3 changes. #3175

Merged
merged 11 commits into from
Feb 21, 2025
Merged

3.0 RC3 changes. #3175

merged 11 commits into from
Feb 21, 2025

Conversation

T4rk1n
Copy link
Contributor

@T4rk1n T4rk1n commented Feb 20, 2025

  • Fix ExternalWrapper rendering children nodes.
  • Improved error for removed Dash app attribute, run_server and long_callback
  • expose stringifyId in dash_component_api

@BSd3v
Copy link
Contributor

BSd3v commented Feb 21, 2025

Should the ExternalWrapper also account for pattern-matching ids? Or is this something the dev should account for?

@gvwilson gvwilson added feature something new P1 needed for current cycle labels Feb 21, 2025
@T4rk1n
Copy link
Contributor Author

T4rk1n commented Feb 21, 2025

Should the ExternalWrapper also account for pattern-matching ids?

Yes, should be working now 🙂

Comment on lines +11 to +26
ExternalComponent(
id="ext",
input_id="external",
text="external",
extra_component={
"type": "Div",
"namespace": "dash_html_components",
"props": {
"id": "extra",
"children": [
html.Div("extra children", id={"type": "extra", "index": 1})
],
},
},
),
html.Div(html.Div(id={"type": "output", "index": 1}), id="out"),
Copy link
Contributor

@BSd3v BSd3v Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldnt this be rewritten as:
extra_component = html.Div(html.Div('extra_children', id={'index':1, 'type': 'extra'}),id='extra')

Or was this to test the different ways this could be listed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it can they get serialized on the backend, there is the two ways tested here with the children as a div.

Comment on lines +36 to 41
addComponentToLayout({
component: {
type: componentType,
namespace: componentNamespace,
props: {}
props: props
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this unpack in a different way than the standard dash components?

For ease of use, would it be easier to just pass a regular dash component {type, namespace, props} directly here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefixed those type and namespace with component in the ExternalWrapper props to be able to use type in the ...props since that is a common prop name.

Copy link
Contributor

@BSd3v BSd3v Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, doesnt Dash deal with this by putting those into props and passing the whole object to it? Its not normal to break apart the props in the way that the ExternalWrapper is accepting it.

eg. Just the way it is above. Its creating the props object by the leftover props by default.

Comment on lines +194 to +212
def test_hook010_hook_custom_data(hook_cleanup, dash_duo):
@hooks.custom_data("custom")
def custom_data(_):
return "custom-data"

app = Dash()
app.layout = [html.Button("insert", id="btn"), html.Div(id="output")]

@app.callback(
Output("output", "children"),
Input("btn", "n_clicks"),
prevent_initial_call=True,
)
def cb(_):
return ctx.custom_data.custom

dash_duo.start_server(app)
dash_duo.wait_for_element("#btn").click()
dash_duo.wait_for_text_to_equal("#output", "custom-data")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@T4rk1n T4rk1n merged commit 0049cab into dash-3.0 Feb 21, 2025
2 of 3 checks passed
@T4rk1n T4rk1n deleted the external-children branch February 21, 2025 18:04
@gvwilson
Copy link
Contributor

woo hoo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P1 needed for current cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants