diff --git a/CHANGELOG.md b/CHANGELOG.md index ecbf1be..77bfd60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.13.2] - 2018-07-24 +### Fixed +- Attempting to render a `Boolean` value to the page no longer crashes the app. + ## [0.13.1] - 2018-07-18 ### Fixed - If a callback references an `id` which does not exist in the DOM tree at the time it is executed, throw an informative front-end exception (previously an uninformative front-end exception was thrown). https://github.com/plotly/dash-renderer/issues/57 diff --git a/src/TreeContainer.js b/src/TreeContainer.js index 5c827d2..5250d6c 100644 --- a/src/TreeContainer.js +++ b/src/TreeContainer.js @@ -21,7 +21,7 @@ TreeContainer.propTypes = { } function render(component) { - if (R.contains(R.type(component), ['String', 'Number', 'Null'])) { + if (R.contains(R.type(component), ['String', 'Number', 'Null', 'Boolean'])) { return component; } @@ -39,7 +39,7 @@ function render(component) { } else if (R.contains( R.type(component.props.children), - ['String', 'Number', 'Null']) + ['String', 'Number', 'Null', 'Boolean']) ) { children = [component.props.children]; diff --git a/tests/test_render.py b/tests/test_render.py index 0a3f946..dc1c68e 100644 --- a/tests/test_render.py +++ b/tests/test_render.py @@ -73,38 +73,39 @@ def test_initial_state(self): app.layout = html.Div([ 'Basic string', 3.14, + True, None, html.Div('Child div with basic string', - id='p.c.3', + id='p.c.4', className="my-class", title='tooltip', style={'color': 'red', 'fontSize': 30} ), - html.Div(id='p.c.4'), + html.Div(id='p.c.5'), html.Div([ - html.Div('Grandchild div', id='p.c.5.p.c.0'), + html.Div('Grandchild div', id='p.c.6.p.c.0'), html.Div([ - html.Div('Great grandchild', id='p.c.5.p.c.1.p.c.0'), + html.Div('Great grandchild', id='p.c.6.p.c.1.p.c.0'), 3.14159, 'another basic string' - ], id='p.c.5.p.c.1'), + ], id='p.c.6.p.c.1'), html.Div([ html.Div( html.Div([ html.Div([ html.Div( - id='p.c.5.p.c.2.p.c.0.p.c.p.c.0.p.c.0' + id='p.c.6.p.c.2.p.c.0.p.c.p.c.0.p.c.0' ), '', html.Div( - id='p.c.5.p.c.2.p.c.0.p.c.p.c.0.p.c.2' + id='p.c.6.p.c.2.p.c.0.p.c.p.c.0.p.c.2' ) - ], id='p.c.5.p.c.2.p.c.0.p.c.p.c.0') - ], id='p.c.5.p.c.2.p.c.0.p.c'), - id='p.c.5.p.c.2.p.c.0' + ], id='p.c.6.p.c.2.p.c.0.p.c.p.c.0') + ], id='p.c.6.p.c.2.p.c.0.p.c'), + id='p.c.6.p.c.2.p.c.0' ) - ], id='p.c.5.p.c.2') - ], id='p.c.5') + ], id='p.c.6.p.c.2') + ], id='p.c.6') ]) self.startServer(app) @@ -122,16 +123,16 @@ def test_initial_state(self): Child div with basic string -
+
-
-
+
+
Grandchild div
-
-
+
+
Great grandchild
@@ -140,16 +141,16 @@ def test_initial_state(self): another basic string
-
-
-
-
+
+
+
+
-
+
-
+
@@ -171,7 +172,7 @@ def test_initial_state(self): 'style="font-size: 30px; color: red;"' ] permutations = itertools.permutations([ - 'id="p.c.3"', + 'id="p.c.4"', 'class="my-class"', 'title="tooltip"', ], 3) @@ -224,12 +225,13 @@ def test_initial_state(self): "children": [ "Basic string", 3.14, + True, None, { "namespace": "dash_html_components", "props": { "children": "Child div with basic string", - "id": "p.c.3", + "id": "p.c.4", 'className': "my-class", 'title': 'tooltip', 'style': { @@ -242,7 +244,7 @@ def test_initial_state(self): "namespace": "dash_html_components", "props": { "children": None, - "id": "p.c.4" + "id": "p.c.5" }, "type": "Div" }, @@ -254,7 +256,7 @@ def test_initial_state(self): "namespace": "dash_html_components", "props": { "children": "Grandchild div", - "id": "p.c.5.p.c.0" + "id": "p.c.6.p.c.0" }, "type": "Div" }, @@ -266,14 +268,14 @@ def test_initial_state(self): "namespace": "dash_html_components", "props": { "children": "Great grandchild", - "id": "p.c.5.p.c.1.p.c.0" + "id": "p.c.6.p.c.1.p.c.0" }, "type": "Div" }, 3.14159, "another basic string" ], - "id": "p.c.5.p.c.1" + "id": "p.c.6.p.c.1" }, "type": "Div" }, @@ -296,7 +298,7 @@ def test_initial_state(self): "namespace": "dash_html_components", "props": { "children": None, - "id": "p.c.5.p.c.2.p.c.0.p.c.p.c.0.p.c.0" + "id": "p.c.6.p.c.2.p.c.0.p.c.p.c.0.p.c.0" }, "type": "Div" }, @@ -305,31 +307,31 @@ def test_initial_state(self): "namespace": "dash_html_components", "props": { "children": None, - "id": "p.c.5.p.c.2.p.c.0.p.c.p.c.0.p.c.2" + "id": "p.c.6.p.c.2.p.c.0.p.c.p.c.0.p.c.2" }, "type": "Div" } ], - "id": "p.c.5.p.c.2.p.c.0.p.c.p.c.0" + "id": "p.c.6.p.c.2.p.c.0.p.c.p.c.0" }, "type": "Div" } ], - "id": "p.c.5.p.c.2.p.c.0.p.c" + "id": "p.c.6.p.c.2.p.c.0.p.c" }, "type": "Div" }, - "id": "p.c.5.p.c.2.p.c.0" + "id": "p.c.6.p.c.2.p.c.0" }, "type": "Div" } ], - "id": "p.c.5.p.c.2" + "id": "p.c.6.p.c.2" }, "type": "Div" } ], - "id": "p.c.5" + "id": "p.c.6" }, "type": "Div" } @@ -369,60 +371,60 @@ def test_initial_state(self): 'return window.store.getState().paths' ), { - "p.c.3": [ - "props", "children", 3 - ], "p.c.4": [ "props", "children", 4 ], "p.c.5": [ "props", "children", 5 ], - "p.c.5.p.c.0": [ - "props", "children", 5, + "p.c.6": [ + "props", "children", 6 + ], + "p.c.6.p.c.0": [ + "props", "children", 6, "props", "children", 0 ], - "p.c.5.p.c.1": [ - "props", "children", 5, + "p.c.6.p.c.1": [ + "props", "children", 6, "props", "children", 1 ], - "p.c.5.p.c.1.p.c.0": [ - "props", "children", 5, + "p.c.6.p.c.1.p.c.0": [ + "props", "children", 6, "props", "children", 1, "props", "children", 0 ], - "p.c.5.p.c.2": [ - "props", "children", 5, + "p.c.6.p.c.2": [ + "props", "children", 6, "props", "children", 2 ], - "p.c.5.p.c.2.p.c.0": [ - "props", "children", 5, + "p.c.6.p.c.2.p.c.0": [ + "props", "children", 6, "props", "children", 2, "props", "children", 0 ], - "p.c.5.p.c.2.p.c.0.p.c": [ - "props", "children", 5, + "p.c.6.p.c.2.p.c.0.p.c": [ + "props", "children", 6, "props", "children", 2, "props", "children", 0, "props", "children" ], - "p.c.5.p.c.2.p.c.0.p.c.p.c.0": [ - "props", "children", 5, + "p.c.6.p.c.2.p.c.0.p.c.p.c.0": [ + "props", "children", 6, "props", "children", 2, "props", "children", 0, "props", "children", "props", "children", 0 ], - "p.c.5.p.c.2.p.c.0.p.c.p.c.0.p.c.0": [ - "props", "children", 5, + "p.c.6.p.c.2.p.c.0.p.c.p.c.0.p.c.0": [ + "props", "children", 6, "props", "children", 2, "props", "children", 0, "props", "children", "props", "children", 0, "props", "children", 0 ], - "p.c.5.p.c.2.p.c.0.p.c.p.c.0.p.c.2": [ - "props", "children", 5, + "p.c.6.p.c.2.p.c.0.p.c.p.c.0.p.c.2": [ + "props", "children", 6, "props", "children", 2, "props", "children", 0, "props", "children",