Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Think harder about truthiness and action buttons #43

Open
cpsievert opened this issue Jan 28, 2022 · 4 comments · May be fixed by #44
Open

Think harder about truthiness and action buttons #43

cpsievert opened this issue Jan 28, 2022 · 4 comments · May be fixed by #44

Comments

@cpsievert
Copy link
Collaborator

Currently req(0) throws a SilentException (because if 0: is falsy in python), which means we don't really need to special case input_action_button() like we do in R since isTruthy(0)==TRUE

@cpsievert
Copy link
Collaborator Author

In other words, should we be implementing a similar is_truthy() or removing the ShinyActionButton class?

@wch
Copy link
Collaborator

wch commented Jan 28, 2022

For context: because 0 is a legitimate value for sliders and numeric inputs, it would be surprising for req(0) to throw a SilentException. (In R, req(0) does not throw a SilentException).

@jcheng5
Copy link
Collaborator

jcheng5 commented Jun 16, 2022

Can we not have Shiny action buttons return 0? I would much rather they return None. (We could do this without changing the JS side, just have the input handler do the modification.) The only reason I didn't do this in R is because I wrote lots of examples with if (input$button != 0) in the early days.

@cpsievert
Copy link
Collaborator Author

Can we not have Shiny action buttons return 0? I would much rather they return None.

We can certainly do that ...do you also want it to return a special object with only __bool__ implemented when >0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants