Skip to content

Commit

Permalink
fix(base component): Don't remove non-elements
Browse files Browse the repository at this point in the history
  • Loading branch information
kantord committed Mar 9, 2018
1 parent 6cb527c commit fde8467
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/base_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const create_bind_function = (args, instance_args) => (selection) => {
if (element === null || (element && element.node
&& !document.contains(element.node()))) return
state_handler.subscribe(me)
element.remove()
if (element) element.remove()
element = create_element(
args.init, format_arguments(instance_args), selection)
render_()
Expand Down
6 changes: 3 additions & 3 deletions src/manual_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ render_dashboard(`
dashboard "Cereals":
- h1 text: "Cereals"
- h2 text: "By calories"
- dropdown my_var=foo:
- {"value": "foo", "text": "Foo"}
- {"value": "bar", "text": "Bar"}
- bar chart:
- attr:query: '{"columns": [(sort_by(-(.calories | tonumber)) | .[] | [.name, .calories])]}'
- data: https://gist.githubusercontent.com/ZeningQu/6184eaf8faa533e320abc938c4738c3e/raw/40f237de825061faa8721c2293b79c46979780b4/cereals.csv
- h2 text: "By nutritional profile"
- 4 columns:
- attr:query: '.[] | {"component": "rows", "data": [{"component": "text", "args": {"tagName": "h3"}, "data": .name}, {"component": "chart", "args": {"type": "pie"}, "data": {"columns": [["protein", .protein], ["carbo", .carbo], ["sugars", .sugars], ["fat", .fat]]}}]}'
- data: https://gist.githubusercontent.com/ZeningQu/6184eaf8faa533e320abc938c4738c3e/raw/40f237de825061faa8721c2293b79c46979780b4/cereals.csv
- dropdown my_var=foo:
- {"value": "foo", "text": "Foo"}
- {"value": "bar", "text": "Bar"}
`)

0 comments on commit fde8467

Please sign in to comment.