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

[BUG] react Warning: Received true for a non-boolean attribute persistence #1209

Closed
eddy-geek opened this issue Apr 22, 2020 · 1 comment
Closed

Comments

@eddy-geek
Copy link
Contributor

System

  • OS: Ubuntu 18.04
  • Browser: latest stable, both chrome 81 & firefox 75
  • fresh venv with just pip install dash. Also tested in dash 1.10 and master (1.12pre)
dash==1.11.0
dash-core-components==1.9.1
dash-html-components==1.0.3
dash-renderer==1.4.0
dash-table==4.6.2

Describe the bug

With very simple persisted inputs like dcc.Input(id="input-1-state", type="text", value="Montreal", persistence=True),, the following warning appears in the javascript console:

```Warning: Received true for a non-boolean attribute `persistence````

full code & stack

with the following code:

import dash_core_components as dcc
import dash_html_components as html
from dash import Dash
from dash.dependencies import Input, Output, State

app = Dash(__name__)

layout = html.Div(
    [
        dcc.Input(id="input-1-state", type="text", value="Montreal", persistence=True),
        dcc.Input(id="input-2-state", type="text", value="Canada", persistence=True),
        html.Button(id="submit-button", n_clicks=0, children="Submit"),
        html.Div(id="output-state"),
    ]
)
app.layout = layout

@app.callback(
    Output("output-state", "children"),
    [Input("submit-button", "n_clicks")],
    [State("input-1-state", "value"), State("input-2-state", "value")],
)
def update_output(n_clicks, input1, input2):
    return (
        "The Button has been pressed {} times,"
        'Input 1 is "{}",'
        'and Input 2 is "{}"'
    ).format(n_clicks, input1, input2)


app.run_server(debug=True, host='0.0.0.0', port=8051)
Warning: Received `true` for a non-boolean attribute `persistence`.

If you want to write it to the DOM, pass a string instead: persistence="true" or persistence={value.toString()}.
    in input (created by n)
    in n (created by CheckedComponent)
    in CheckedComponent (created by TreeContainer)
    in UnconnectedComponentErrorBoundary (created by withRadiumContexts(UnconnectedComponentErrorBoundary))
    in withRadiumContexts(UnconnectedComponentErrorBoundary) (created by ConnectFunction)
    in ConnectFunction (created by TreeContainer)
    in TreeContainer (created by ConnectFunction)
    in ConnectFunction (created by TreeContainer)
    in div (created by u)
    in u (created by CheckedComponent)
    in CheckedComponent (created by TreeContainer)
    in UnconnectedComponentErrorBoundary (created by withRadiumContexts(UnconnectedComponentErrorBoundary))
    in withRadiumContexts(UnconnectedComponentErrorBoundary) (created by ConnectFunction)
    in ConnectFunction (created by TreeContainer)
    in TreeContainer (created by ConnectFunction)
    in ConnectFunction (created by UnconnectedContainer)
    in div (created by UnconnectedGlobalErrorContainer)
    in div (created by GlobalErrorOverlay)
    in div (created by GlobalErrorOverlay)
    in GlobalErrorOverlay (created by DebugMenu)
    in div (created by DebugMenu)
    in DebugMenu (created by UnconnectedGlobalErrorContainer)
    in div (created by UnconnectedGlobalErrorContainer)
    in UnconnectedGlobalErrorContainer (created by withRadiumContexts(UnconnectedGlobalErrorContainer))
    in withRadiumContexts(UnconnectedGlobalErrorContainer) (created by ConnectFunction)
    in ConnectFunction (created by UnconnectedContainer)
    in UnconnectedContainer (created by ConnectFunction)
    in ConnectFunction (created by UnconnectedAppContainer)
    in UnconnectedAppContainer (created by ConnectFunction)
    in ConnectFunction (created by AppProvider)
    in Provider (created by AppProvider)
    in AppProvider

Functionality does not appear to be affected.

Expected behavior

No console warning. If I'm doing something wrong, I'd prefer an error in the python logs &| the UI.

Screenshots

image

@alexcjohnson
Copy link
Collaborator

Thanks @eddy-geek - this is not harmful but it is certainly annoying. The root cause is prop forwarding with omit plotly/dash-core-components#703. Closing here and I'll reference your use case there.

janosh added a commit to materialsproject/crystaltoolkit that referenced this issue Aug 2, 2023
…ribute `persistence`.

If you want to write it to the DOM, pass a string instead: persistence="true" or persistence={value.toString()}.

see plotly/dash#1209
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

2 participants