Skip to content

Add persistence to components #104

Closed

Description

@stlehmann

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?

Activity

  1. alexcjohnson commented on Apr 16, 2020

    @alexcjohnson
    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.

  2. changed the title [-]Add persistance to components[/-] [+]Add persistence to components[/+] on Apr 17, 2020
  3. stlehmann commented on Apr 18, 2020

    @stlehmann
    ContributorAuthor

    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>)
    
    
  4. alexcjohnson commented on Apr 24, 2020

    @alexcjohnson
    Collaborator

    Closed by @stlehmann in #105 🎉

  5. Karan-S-Mittal commented on Aug 23, 2021

    @Karan-S-Mittal
    Contributor

    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?

  6. stlehmann commented on Aug 28, 2021

    @stlehmann
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions