Skip to content

Conversation

@sfc-gh-tteixeira
Copy link
Contributor

@sfc-gh-tteixeira sfc-gh-tteixeira commented Sep 17, 2024

Describe your changes

  • Convert many components to functional
    • Components that were straight applications of useBasicWidgetState:
      • st.time_input
      • st.date_input
      • st.color_picker
      • st.selectbox
    • Components that require an extra "commit" step to save values to the state:
      • st.text_input
      • st.text_area
    • Components that have a "commit" step and other complexities:
      • st.slider / st.select_slider
  • Rename setValueWSource to setValueWithSource
  • Move some usage of FormClearHelper to useFormClearHelper: st.number_input, st.dataframe, st.button_group
  • Clean up st.number_input a little
  • Change st.slider algorithm

GitHub Issue Link (if applicable)

Testing Plan

  • Explanation of why no additional tests are needed
  • Unit Tests (JS and/or Python)
  • E2E Tests
  • Any manual testing needed?
    • Yes! Would love tests of:
      • All widgets above + session state
      • All widgets above + developer changes some parameters in the source code

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

Copy link
Collaborator

@raethlein raethlein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great that more and more widgets are modernized, thank you 🚀
I love the slider update and am totally fine to do it in one PR; the only ask I have is to add some form of testing (see my comment). Since adding some tests can be a little bit more time involved, maybe we can have it as a separate PR and find someone from the team to add them if you are busy right now 🙂 What do you think?
Other than that I have just left a few nits and feel free to merge after you had a look!

@sfc-gh-tteixeira
Copy link
Contributor Author

I added screenshot tests for the slider overlap algorithm. I still need to update the screenshots, but I'm waiting for the automation to do it for me.

@raethlein raethlein force-pushed the functionalcomponents branch 3 times, most recently from eb0979f to a5ea04c Compare October 25, 2024 04:16
@raethlein raethlein force-pushed the functionalcomponents branch from a5ea04c to 5b4a4c8 Compare October 25, 2024 04:23
@sfc-gh-tteixeira sfc-gh-tteixeira merged commit a051ac7 into develop Oct 25, 2024
raethlein added a commit that referenced this pull request Oct 25, 2024
## Describe your changes

In #9494 a dynamic way was
added to calculate the slider labels. It looks like the added snapshot
tests are flaky (on Firefox). It looks like the pixel values can have a
few decimal values which seems to shift the label slightly.

## GitHub Issue Link (if applicable)

## Testing Plan

- Fix flaky tests, so change is covered by them.

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.
edegp pushed a commit to edegp/streamlit that referenced this pull request Jan 19, 2025
…streamlit#9494)

## Describe your changes

- Convert many components to functional
- Components that were straight applications of `useBasicWidgetState`:
      - `st.time_input`
      - `st.date_input`
      - `st.color_picker`
      - `st.selectbox`
- Components that require an extra "commit" step to save values to the
state:
      - `st.text_input`
      - `st.text_area`
  - Components that have a "commit" step and other complexities:
      - `st.slider` / `st.select_slider`
- Rename `setValueWSource` to `setValueWithSource`
- Move some usage of `FormClearHelper` to `useFormClearHelper`:
`st.number_input`, `st.dataframe`, `st.button_group`
- Clean up `st.number_input` a little
- Change `st.slider` algorithm

## GitHub Issue Link (if applicable)

## Testing Plan

- ~~Explanation of why no additional tests are needed~~
- [x] Unit Tests (JS and/or Python)
- [x] E2E Tests
- Any manual testing needed?
  - Yes! Would love tests of:
    - All widgets above + session state
- All widgets above + developer changes some parameters in the source
code

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.
edegp pushed a commit to edegp/streamlit that referenced this pull request Jan 19, 2025
## Describe your changes

In streamlit#9494 a dynamic way was
added to calculate the slider labels. It looks like the added snapshot
tests are flaky (on Firefox). It looks like the pixel values can have a
few decimal values which seems to shift the label slightly.

## GitHub Issue Link (if applicable)

## Testing Plan

- Fix flaky tests, so change is covered by them.

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.
@lukasmasuch lukasmasuch deleted the functionalcomponents branch March 7, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:refactor PR contains code refactoring without behavior change impact:internal PR changes only affect internal code security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants