Skip to content

Add persistence to components #104

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

Closed
stlehmann opened this issue Apr 16, 2020 · 5 comments
Closed

Add persistence to components #104

stlehmann opened this issue Apr 16, 2020 · 5 comments

Comments

@stlehmann
Copy link
Contributor

Thanks for this great library. I enjoy the beautiful-styled controls and often use them in my projects. Lately I found out that Dash supports a convenient way to make user-data persistent by adding a persistence attribute. So a slider that keeps its data persistant now basically comes down to one line of code:

slider = dcc.Slider(id="slider_1", persistence=True, persistence_type="local")

This dramatically simplifies the cases where before one had to pass all user-values to a Store component. I would love to see this feature implemented in dash-daq components and also would be willing to contribute. What are your thoughts?

@alexcjohnson
Copy link
Collaborator

Absolutely, we'd happily review a PR! It's straightforward, all you have to do is add the appropriate props and dash-renderer will take care of the rest. See plotly/dash-core-components#646 for an example.

@stlehmann stlehmann changed the title Add persistance to components Add persistence to components Apr 17, 2020
@stlehmann
Copy link
Contributor Author

Is there a recommended build-system? I always get errors when using yarn start like described in the Readme. I tried it on Ubuntu and Mac OS with yarn 1.22.4 and npm 6.14.4.

$ copyfiles -u 1 lib/* dash_daq
Error with path src/components/ColorPicker.react.jsError: did not recognize object of type "ImportExpression"
Error: did not recognize object of type "ImportExpression"
    at Object.getFieldNames (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/ast-types/lib/types.js:701:19)
    at getSortedChildNodes (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:50:23)
    at getSortedChildNodes (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:63:9)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:73:22)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at /Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:129:9
    at Array.forEach (<anonymous>)
Error with path src/components/Slider.react.jsError: did not recognize object of type "ImportExpression"
Error: did not recognize object of type "ImportExpression"
    at Object.getFieldNames (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/ast-types/lib/types.js:701:19)
    at getSortedChildNodes (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:50:23)
    at getSortedChildNodes (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:63:9)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:73:22)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at /Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:129:9
    at Array.forEach (<anonymous>)

@alexcjohnson
Copy link
Collaborator

Closed by @stlehmann in #105 🎉

@Karan-S-Mittal
Copy link
Contributor

Karan-S-Mittal commented Aug 23, 2021

Is there a recommended build-system? I always get errors when using yarn start like described in the Readme. I tried it on Ubuntu and Mac OS with yarn 1.22.4 and npm 6.14.4.

$ copyfiles -u 1 lib/* dash_daq
Error with path src/components/ColorPicker.react.jsError: did not recognize object of type "ImportExpression"
Error: did not recognize object of type "ImportExpression"
    at Object.getFieldNames (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/ast-types/lib/types.js:701:19)
    at getSortedChildNodes (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:50:23)
    at getSortedChildNodes (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:63:9)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:73:22)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at /Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:129:9
    at Array.forEach (<anonymous>)
Error with path src/components/Slider.react.jsError: did not recognize object of type "ImportExpression"
Error: did not recognize object of type "ImportExpression"
    at Object.getFieldNames (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/ast-types/lib/types.js:701:19)
    at getSortedChildNodes (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:50:23)
    at getSortedChildNodes (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:63:9)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:73:22)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at decorateComment (/Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:84:13)
    at /Users/stefan/Documents/070_Python/050_Forks/dash-daq/node_modules/recast/lib/comments.js:129:9
    at Array.forEach (<anonymous>)

Hey, how did you resolve this issue? I am trying to build the library and these two files generate the same error for me. I was able to run the yarn dash-demo command or demo.py as I changed the Slider to Slider.Slider and ColorPicker to ColorPicker.ColorPicker but is there something I am missing that will generate these two files as well?

@stlehmann
Copy link
Contributor Author

Hey, how did you resolve this issue? I am trying to build the library and these two files generate the same error for me. I was able to run the yarn dash-demo command or demo.py as I changed the Slider to Slider.Slider and ColorPicker to ColorPicker.ColorPicker but is there something I am missing that will generate these two files as well?

Actually I think I wasn't able to build it on my own computer so I had to rely on CI to do building for me. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants