I figured it out. The error occurs because before uploading a file, stored_json_data is empty, and hence an empty tuple is returned, which cannot be parsed. The solution is to test if isempty(stored_json_data), and if true I just return a line break.
callback!(app,
Output("select_targets", "children"),
Input("store_data", "data"),
prevent_initial_call=true) do stored_json_data
if isempty(stored_json_data)
return html_br()
else
# convert from JSON to dataframe
d = DataFrame(JSON.parse(stored_json_data)) # error is here
return html_div([
html_br(),
html_p("Select target"),
dcc_dropdown(id="target",
options=[(label = i, value=i) for i in unique(d.group)],
style=Dict("width" => "40%")),
html_button("Create graph", id="button")
])
end
end