-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
3.0 RC3 changes. #3175
Changes from all commits
216dcf8
e44f228
1cd9c05
64627a5
f397f8a
0c01a79
61ff4f6
707399b
b415d22
901f03a
4336b34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import os | ||
|
||
__version__ = "2.0.1" | ||
__version__ = "2.0.2" | ||
|
||
_available_react_versions = {"18.3.1", "18.2.0", "16.14.0"} | ||
_available_reactdom_versions = {"18.3.1", "18.2.0", "16.14.0"} | ||
|
@@ -64,7 +64,7 @@ def _set_react_version(v_react, v_reactdom=None): | |
{ | ||
"relative_package_path": "dash-renderer/build/dash_renderer.min.js", | ||
"dev_package_path": "dash-renderer/build/dash_renderer.dev.js", | ||
"external_url": "https://unpkg.com/[email protected].1" | ||
"external_url": "https://unpkg.com/[email protected].2" | ||
"/build/dash_renderer.min.js", | ||
"namespace": "dash", | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# pylint: disable=too-few-public-methods | ||
from .exceptions import ObsoleteAttributeException | ||
|
||
|
||
class ObsoleteAttribute: | ||
def __init__(self, message: str, exc=ObsoleteAttributeException): | ||
self.message = message | ||
self.exc = exc | ||
|
||
|
||
class ObsoleteChecker: | ||
_obsolete_attributes = { | ||
"run_server": ObsoleteAttribute("app.run_server has been replaced by app.run"), | ||
"long_callback": ObsoleteAttribute( | ||
"app.long_callback has been removed, use app.callback(..., background=True) instead" | ||
), | ||
} | ||
|
||
def __getattr__(self, name: str): | ||
if name in self._obsolete_attributes: | ||
err = self._obsolete_attributes[name] | ||
raise err.exc(err.message) | ||
return getattr(self, name) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "3.0.0rc2" | ||
__version__ = "3.0.0rc3" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from dash import Dash, html, dcc, html, Input, Output, State | ||
from dash import Dash, html, dcc, html, Input, Output, State, MATCH | ||
from dash_test_components import ExternalComponent | ||
|
||
|
||
|
@@ -8,7 +8,22 @@ def test_rext001_render_external_component(dash_duo): | |
[ | ||
dcc.Input(id="sync", value="synced"), | ||
html.Button("sync", id="sync-btn"), | ||
ExternalComponent("ext", input_id="external", text="external"), | ||
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"), | ||
Comment on lines
+11
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldnt this be rewritten as: Or was this to test the different ways this could be listed? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
] | ||
) | ||
|
||
|
@@ -21,7 +36,20 @@ def test_rext001_render_external_component(dash_duo): | |
def on_sync(_, value): | ||
return value | ||
|
||
@app.callback( | ||
Output({"type": "output", "index": MATCH}, "children"), | ||
Input({"type": "extra", "index": MATCH}, "n_clicks"), | ||
prevent_initial_call=True, | ||
) | ||
def click(*_): | ||
return "clicked" | ||
|
||
dash_duo.start_server(app) | ||
dash_duo.wait_for_text_to_equal("#external", "external") | ||
dash_duo.find_element("#sync-btn").click() | ||
dash_duo.wait_for_text_to_equal("#external", "synced") | ||
|
||
dash_duo.wait_for_text_to_equal("#extra", "extra children") | ||
|
||
dash_duo.find_element("#extra > div").click() | ||
dash_duo.wait_for_text_to_equal("#out", "clicked") |
There was a problem hiding this comment.
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?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefixed those
type
andnamespace
withcomponent
in the ExternalWrapper props to be able to usetype
in the...props
since that is a common prop name.There was a problem hiding this comment.
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 wholeobject
to it? Its not normal to break apart theprops
in the way that theExternalWrapper
is accepting it.eg. Just the way it is above. Its creating the
props
object
by the leftover props by default.