{"action":"created","issue":{"url":"https://api.github.com/repos/StratoDem/sd-material-ui/issues/92","repository_url":"https://api.github.com/repos/StratoDem/sd-material-ui","labels_url":"https://api.github.com/repos/StratoDem/sd-material-ui/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/StratoDem/sd-material-ui/issues/92/comments","events_url":"https://api.github.com/repos/StratoDem/sd-material-ui/issues/92/events","html_url":"https://github.com/StratoDem/sd-material-ui/issues/92","id":378310440,"node_id":"MDU6SXNzdWUzNzgzMTA0NDA=","number":92,"title":"Snackbar \"open\" not resetting to False","user":{"login":"kw3179","id":22304661,"node_id":"MDQ6VXNlcjIyMzA0NjYx","avatar_url":"https://avatars0.githubusercontent.com/u/22304661?v=4","gravatar_id":"","url":"https://api.github.com/users/kw3179","html_url":"https://github.com/kw3179","followers_url":"https://api.github.com/users/kw3179/followers","following_url":"https://api.github.com/users/kw3179/following{/other_user}","gists_url":"https://api.github.com/users/kw3179/gists{/gist_id}","starred_url":"https://api.github.com/users/kw3179/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kw3179/subscriptions","organizations_url":"https://api.github.com/users/kw3179/orgs","repos_url":"https://api.github.com/users/kw3179/repos","events_url":"https://api.github.com/users/kw3179/events{/privacy}","received_events_url":"https://api.github.com/users/kw3179/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"coralvanda","id":16080662,"node_id":"MDQ6VXNlcjE2MDgwNjYy","avatar_url":"https://avatars3.githubusercontent.com/u/16080662?v=4","gravatar_id":"","url":"https://api.github.com/users/coralvanda","html_url":"https://github.com/coralvanda","followers_url":"https://api.github.com/users/coralvanda/followers","following_url":"https://api.github.com/users/coralvanda/following{/other_user}","gists_url":"https://api.github.com/users/coralvanda/gists{/gist_id}","starred_url":"https://api.github.com/users/coralvanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coralvanda/subscriptions","organizations_url":"https://api.github.com/users/coralvanda/orgs","repos_url":"https://api.github.com/users/coralvanda/repos","events_url":"https://api.github.com/users/coralvanda/events{/privacy}","received_events_url":"https://api.github.com/users/coralvanda/received_events","type":"User","site_admin":false},"assignees":[{"login":"coralvanda","id":16080662,"node_id":"MDQ6VXNlcjE2MDgwNjYy","avatar_url":"https://avatars3.githubusercontent.com/u/16080662?v=4","gravatar_id":"","url":"https://api.github.com/users/coralvanda","html_url":"https://github.com/coralvanda","followers_url":"https://api.github.com/users/coralvanda/followers","following_url":"https://api.github.com/users/coralvanda/following{/other_user}","gists_url":"https://api.github.com/users/coralvanda/gists{/gist_id}","starred_url":"https://api.github.com/users/coralvanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coralvanda/subscriptions","organizations_url":"https://api.github.com/users/coralvanda/orgs","repos_url":"https://api.github.com/users/coralvanda/repos","events_url":"https://api.github.com/users/coralvanda/events{/privacy}","received_events_url":"https://api.github.com/users/coralvanda/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-11-07T14:27:09Z","updated_at":"2018-11-12T14:29:07Z","closed_at":null,"author_association":"NONE","body":"Hi!\r\n\r\nI have a snackbar in my project, with a callback that tells it to open by setting the snackbar's \"open\" to True. Once autoHideDuration is triggered, \"open\" should be reset to False - however, it is staying True and the snackbar opens on every change to the page after that (there are other dropdowns on the page that have nothing to do with the snackbar that trigger it to pop up again).\r\n\r\n```\r\n...\r\nmaterialui.Snackbar(id='snackbar', open=False, message='Alerts updated', autoHideDuration=3000)\r\n... \r\n\r\n@app.callback(\r\n    dash.dependencies.Output('snackbar', 'open'),\r\n    [dash.dependencies.Input('modal', 'cancel_n_clicks_timestamp'),\r\n    dash.dependencies.Input('modal', 'submit_n_clicks_timestamp')])\r\ndef handle_snackbar(cancel_n_clicks_timestamp = 0, submit_n_clicks_timestamp = 0):\r\n    if submit_n_clicks_timestamp is None:\r\n        submit_n_clicks_timestamp = 0\r\n    if cancel_n_clicks_timestamp is None:\r\n        cancel_n_clicks_timestamp = 0\r\n    time_now = calendar.timegm(time.gmtime())\r\n    t_submit = int(submit_n_clicks_timestamp)/1000\r\n    t_cancel= int(cancel_n_clicks_timestamp)/1000\r\n    if abs(t_cancel - time_now) < 1:\r\n        return False\r\n    elif abs(t_submit - time_now) < 1:\r\n        return True\r\n    else:\r\n        return False\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/StratoDem/sd-material-ui/issues/comments/437901096","html_url":"https://github.com/StratoDem/sd-material-ui/issues/92#issuecomment-437901096","issue_url":"https://api.github.com/repos/StratoDem/sd-material-ui/issues/92","id":437901096,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzkwMTA5Ng==","user":{"login":"kw3179","id":22304661,"node_id":"MDQ6VXNlcjIyMzA0NjYx","avatar_url":"https://avatars0.githubusercontent.com/u/22304661?v=4","gravatar_id":"","url":"https://api.github.com/users/kw3179","html_url":"https://github.com/kw3179","followers_url":"https://api.github.com/users/kw3179/followers","following_url":"https://api.github.com/users/kw3179/following{/other_user}","gists_url":"https://api.github.com/users/kw3179/gists{/gist_id}","starred_url":"https://api.github.com/users/kw3179/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kw3179/subscriptions","organizations_url":"https://api.github.com/users/kw3179/orgs","repos_url":"https://api.github.com/users/kw3179/repos","events_url":"https://api.github.com/users/kw3179/events{/privacy}","received_events_url":"https://api.github.com/users/kw3179/received_events","type":"User","site_admin":false},"created_at":"2018-11-12T14:29:07Z","updated_at":"2018-11-12T14:29:07Z","author_association":"NONE","body":"Hi there, @coralvanda! Sorry I didn't provide enough of my code - here's some more:\r\n\r\n``` \r\nhtml.Div([\r\n        dcc.ConfirmDialogProvider(children=html.Button('Update My Alerts'),\r\n        id='modal',\r\n        message='Are you sure you want to update?'\r\n        ),\r\n        html.Div(id='output-provider', style={'display': 'none'})\r\n    ], style={'padding': '36px 0px 0px 18px'}),\r\n\r\n    materialui.Snackbar(id='snackbar', open=False, message='Alerts updated', autoHideDuration=3000)\r\n\r\n    ])\r\n```\r\n\r\n```\r\n@app.callback(\r\n    dash.dependencies.Output('snackbar', 'open'),\r\n    [dash.dependencies.Input('modal', 'cancel_n_clicks_timestamp'),\r\n    dash.dependencies.Input('modal', 'submit_n_clicks_timestamp')])\r\ndef handle_snackbar(cancel_n_clicks_timestamp = 0, submit_n_clicks_timestamp = 0):\r\n    if submit_n_clicks_timestamp is None:\r\n        submit_n_clicks_timestamp = 0\r\n    if cancel_n_clicks_timestamp is None:\r\n        cancel_n_clicks_timestamp = 0\r\n    time_now = calendar.timegm(time.gmtime())\r\n    t_submit = int(submit_n_clicks_timestamp)/1000\r\n    t_cancel= int(cancel_n_clicks_timestamp)/1000\r\n    if abs(t_cancel - time_now) < 1:\r\n        return False\r\n    elif abs(t_submit - time_now) < 1:\r\n        return True\r\n    else:\r\n        return False\r\n```\r\n\r\n`modal` is a ConfirmDialogProvider that pops up when its child button is pressed. I expected that with the callback, when \"submit\" is clicked it should open the snackbar (which it does), but after that the snackbar should not open any more. But, it's popping up on every change we make, even to things like this that aren't connected to it in any way:\r\n\r\n```\r\n    html.Div(children=[\r\n        html.Label('Sensitivity', style={'color': '#666666'}),\r\n        dcc.Slider(\r\n            id='sensitivity-slider',\r\n            min=1,\r\n            max=10,\r\n            value=1,\r\n            marks=\r\n            {'1':'1',\r\n             '2':'2',\r\n             '3':'3',\r\n             '4':'4',\r\n             '5':'5',\r\n             '6':'6',\r\n             '7':'7',\r\n             '8':'8',\r\n             '9':'9',\r\n             '10':'10'}\r\n        )\r\n    ], style={'width': '80%', 'padding': '0px 0px 30px 20px'}),\r\n```\r\n\r\nwhich only has this as a callback:\r\n\r\n```\r\n@app.callback(\r\n    dash.dependencies.Output('graph-with-slider', 'figure'),\r\n    [dash.dependencies.Input('sensitivity-slider', 'value'),\r\n     dash.dependencies.Input('metric-dropdown', 'value'),\r\n     dash.dependencies.Input('algorithm-dropdown', 'value'),\r\n     dash.dependencies.Input('datasource-dropdown','value')])\r\ndef update_figure(sensitivity, metric, algorithm, datasource):\r\n    if algorithm is None and metric is not None:\r\n        return update_graph_no_alg(get_I_data(metric, \"NA\", algorithm))\r\n    elif metric is None:\r\n        return {'data': []} # Clear graph when no metric specified\r\n    elif algorithm == \"I\":\r\n        return update_sensitivity_I(get_I_data(metric, \"NA\", algorithm), sensitivity)\r\n    elif algorithm == \"II\":\r\n        return update_sensitivity_II(get_II_data(metric, \"NA\"), sensitivity)\r\n```\r\n\r\n(I had to change some function names here for privacy purposes).\r\n\r\nAfter clicking \"submit\" on the ConfirmDialogProvider `modal`, changes to `sensitivity-slider` (the slider above), `metric-dropdown` (a dropdown menu), `algorithm-dropdown` (a dropdown menu), and `datasource-dropdown` (a dropdown menu), etc. are causing the snackbar to pop up. But if I click the ConfirmDialogProvider's child button again and click 'cancel', the snackbar no longer comes up on changes (which is why I think \"open\" isn't being reset to 'False'). \r\n\r\nDoes that help explain the problem a little more?\r\n\r\nThanks!"}}
{"actor":{"display_login":"kw3179"}}