Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

true/false as children in layout crashes app #29

Closed
chriddyp opened this issue Nov 22, 2017 · 4 comments
Closed

true/false as children in layout crashes app #29

chriddyp opened this issue Nov 22, 2017 · 4 comments
Assignees
Labels
Type: Bug Something isn't working as intended

Comments

@chriddyp
Copy link
Member

see https://community.plot.ly/t/bug-in-tables-boolean-values-fail-to-render/6872

@chriddyp chriddyp added the Type: Bug Something isn't working as intended label Nov 22, 2017
@chriddyp
Copy link
Member Author

Also see plotly/dash#264

@rmarren1
Copy link
Contributor

To prevent this crash, we would just need to add 'Boolean' to the arrays here and here.
image

This results in a Javascript boolean being passed to the react render function, so nothing is actually rendered on the screen (left in picture) but the boolean value still exists in the react dom (right in picture).

From my own experience, a common use case for setting children as boolean is when many callbacks need to run an expensive boolean function, you can first store the result of the function in the front end. This fix works for that use case, and if a user wants to actually render the boolean they can cast it to a string first.

Does @plotly/dash think this is a good idea? Or should we actually render the strings 'true' or 'false' to the page. Users can just set style={'display': 'none'} when they do not want to render.

@valentijnnieman
Copy link
Contributor

I don't really see a reason why we would render a boolean as a string - like you said, if you'd want that, you can easily cast it to a string first. I also don't see a reason why not to allow booleans to be passed, and if there's a use-case for it, I'd say go for it!

@rmarren1
Copy link
Contributor

rmarren1 commented Aug 1, 2018

Fixed in #62

@rmarren1 rmarren1 closed this as completed Aug 1, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Type: Bug Something isn't working as intended
Projects
None yet
Development

No branches or pull requests

3 participants