-
Notifications
You must be signed in to change notification settings - Fork 4k
Form: warn when submit button is missing #3079
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
Form: warn when submit button is missing #3079
Conversation
* st_form: Set baseUrl to . Speed up CircleCI more (streamlit#3025) Add events to keep track of theme changes and other theme stats (streamlit#3012) Have MetricsManager enqueue events when disconnected (streamlit#3011) Fix for query param issue with base url (streamlit#2894) Add fuzzy search to selectbox (streamlit#2933) Informative repr methods for our python classes (streamlit#3027) ComponentInstance: handle iframe changes (streamlit#3015)
# By Tim Conkling (7) and others # Via GitHub (3) and Tim Conkling (1) * st_form: FormsManager (streamlit#3046) Added "allow-downloads" to the sandbox attributes (streamlit#3053) Small fix for `make pylint` command (streamlit#3062) Set genericColors properly and make theme defs more consistent (streamlit#3051) Downgrade st.warning in local_sources_watcher to a log (streamlit#3050) Extend docstring of st.image (streamlit#3055) Move docs.streamlit.io to Segment (streamlit#3005) Fix bokeh example in docs (`legend` arg) (streamlit#2907) Remove incorrect markdown table styling (streamlit#3038) document getattr Show the beta_warning only a single time per object object_beta_warning: handle every __ magic method object_beta_warning: handle the subscript operator beta_util_test Move secrets out of beta [Security] Upgrade y18n to 4.0.1 or later (streamlit#3041) Fix gap not working on Safari (streamlit#3042) formatting call _repr_html_ when available # Conflicts: # frontend/src/components/core/Block/Block.tsx # frontend/src/components/widgets/Form/Form.tsx # frontend/src/components/widgets/Form/FormSubmitButton.tsx # frontend/src/components/widgets/Form/FormsData.test.ts # frontend/src/components/widgets/Form/FormsManager.ts
| "never be sent to your Streamlit app." + | ||
| "\n\nTo create a submit button, use the `st.beta_submit_button()` function." | ||
|
|
||
| export class Form extends PureComponent<Props, State> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why we didn't use hooks here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a long thread in Slack, but basically: useEffect cleanup callbacks aren't being called in Enzyme tests when a component is unmounted. These classes originally used hooks, and I rewrote them so that I could have running tests.
(Also, Enzyme's shallow() function is incompatible with hooks.)
| size={Size.SMALL} | ||
| disabled={props.disabled || props.hasInProgressUpload} | ||
| onClick={() => props.widgetMgr.submitForm(props.element)} | ||
| export class FormSubmitButton extends PureComponent<Props> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
* st_form: Fix image galleries (streamlit#3044) Is this a red herring also? See if pylint was red herring Update sphinx Specify pylint version Fix pylint errors
If you forget to create a
st.beta_submit_buttoninside your form, we warn you.<Form>creates a timer on creation. If itshasSubmitButtonstate is not true when the timer fires, it will show a warning.(The timer duration, and the warning text, are both placeholder - we'll get a product review on this later. This PR is strictly for functionality.)