-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Updates for dash 3 #499
Updates for dash 3 #499
Conversation
handling removal of
|
handling the removal of
|
Handling removal of
|
@AnnMarieW Great work! Did you find an alternative solution to using the (old) |
Hi @emilhe I chatted with Philippe about that and he mentioned he could add a He said the only thing he didn't like was that It's still used in 4 components in this repo. |
That sounds like a great idea. It would be neat with a 'native' solution 😊 Does that mean that DMC cannot be updated before this fix is available? Or does the old hack still work in Dash 3? (: |
Yes, it works perfectly in both Dash 2 and Dash 3 🎉 I would call it a "brilliant solution" rather than an "old hack" though 🤓 Thanks for making this available! |
That's great! Thanks for the update. I guess there are no known Dash 3 imcompabilites left then (after this PR)? :) |
If you are referring to just DMC, I think I've found them all. The update just needs to be applied to all the components. I'm planning on doing that after the next release. Also, I would welcome any input on what I have so far. Is there a better way to do this? |
Here is the sample app for the Checkbox component. It renders an icon with extra props and needs to be handled differently in dash 2 and dash 2 import dash_mantine_components as dmc
from dash import Dash, _dash_renderer
_dash_renderer._set_react_version("18.2.0")
from dash_iconify import DashIconify
app = Dash(external_stylesheets=dmc.styles.ALL)
component = dmc.Stack([
dmc.Checkbox(
label="Custom checked icon",
checked=True,
icon=DashIconify(icon="ion:bag-check-sharp"),
size="lg",
p=0,
persistence=True,
id="checkbox"
),
dmc.Checkbox(
label="Custom intermediate icons",
indeterminate=True,
indeterminateIcon=DashIconify(icon="material-symbols:indeterminate-question-box"),
size="lg"
)
])
app.layout = dmc.MantineProvider(
component
)
if __name__ == "__main__":
app.run(debug=True) |
src/ts/utils/dash3.ts
Outdated
const childArray = React.Children.toArray(children); | ||
|
||
// Get loading states for all children | ||
const loadingStates = childArray.map((child: any) => |
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 think if you use some
here rather than map
you can benefit from short-circuit evaluation. I.e. you're return true
the first time you encounter a loading child rather than calling useLoading
on all children then calling some
on the resultant array.
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.
Thanks! Updated 🙂
Closed in favor of #506 |
Closes #453
This PR replaces #458 which only handled changes for Dash 3. This PR includes updates for Dash 3 that are also compatible with Dash 2.
_dashprivate_loadingState
used in theSkeleton
component.Checkbox
component which has an icon component prop that needs to be rerender with additional props._dashprivate_layout
: Checkbox, Popover, Menu, Hovercard, Timeline, Stepperpackage.json
, pin "dash-extensions-js": "0.0.8" . Before upgrading, check for Dash 2 compatibility. This package is required for the renderDashComponent function, which may be affected by updates in future Dash versions.Note - do not use the new typing support because it does not handle Mantine typing correctly.
ignore this comment in the build and add notes to releasing.md to ensure it's not added in the future