Skip to content

Allow st.feedback to have a default initial value (#9469)#9658

Closed
wjkim00 wants to merge 3 commits intostreamlit:developfrom
wjkim00:feature/feedback_has_default
Closed

Allow st.feedback to have a default initial value (#9469)#9658
wjkim00 wants to merge 3 commits intostreamlit:developfrom
wjkim00:feature/feedback_has_default

Conversation

@wjkim00
Copy link
Copy Markdown

@wjkim00 wjkim00 commented Oct 13, 2024

Describe your changes

st.feedback has default as initial value

GitHub Issue Link (if applicable)

Closed #9469

Testing Plan

  • Explanation of why no additional tests are needed
  • Unit Tests (JS and/or Python)
  • E2E Tests
  • Any manual testing needed?

Contribution License Agreement

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

@wjkim00 wjkim00 marked this pull request as draft October 13, 2024 13:01
@wjkim00 wjkim00 marked this pull request as ready for review October 13, 2024 13:03
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 28, 2024
@jrieke jrieke changed the title Allow st.feedbak has default as initial value (#9469) Allow st.feedback to have a default initial value (#9469) Nov 4, 2024
@jrieke
Copy link
Copy Markdown
Collaborator

jrieke commented Nov 4, 2024

Hey, this is awesome, thanks for the PR! I'm fine with adding this, I think the main question is what we call the parameter:

  • default as suggested here. That's what we call the parameter for st.multiselect and will also call the parameter for the upcoming st.pills and st.segmented_control, which allow both single and multi select.
  • index as in st.selectbox and st.radio.

In principle, index is a bit more consistent since we are in fact returning an index and it aligns better with st.selectbox and st.radio, which are the two widgets closest to this one. Then again, index is a bit of a weird thing and I'm not sure if we would still do it anymore today... So default seems a bit more future-proof. I'll bring this up for a discussion with the team and will let you know how we decide!

@github-actions github-actions bot removed the stale label Nov 5, 2024
@sfc-gh-braethlein sfc-gh-braethlein force-pushed the feature/feedback_has_default branch from 303e432 to 3b9a110 Compare November 5, 2024 20:29
@raethlein raethlein added security-assessment-completed do-not-merge PR is blocked from merging change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Nov 5, 2024
@raethlein
Copy link
Copy Markdown
Collaborator

@jrieke Another aspect to keep in mind is that options="thumbs" will render (thumbs_up,thumbs_down) with values (1, 0), so the indices (0, 1) are mapped to the values (1, 0). So the question is, would you pass 0 and get 1 or 1 to get value 1 but index 0. I guess the latter, so that st.feedback("thumbs", default=0) returns 1, but wanted to call it out.

@sfc-gh-dmatthews
Copy link
Copy Markdown
Contributor

I guess the latter, so that st.feedback("thumbs", default=0) returns 1, but wanted to call it out.

I think whatever value we pass should be what's returned; the default value, the value in Session State, and the returned value should all exist in the same universe.

@lukasmasuch lukasmasuch added status:needs-triage Issue has not been triaged by the Streamlit team status:needs-product-approval PR requires product approval before merging and removed status:needs-triage Issue has not been triaged by the Streamlit team labels May 19, 2025
@jrieke jrieke assigned jrieke and unassigned jrieke May 22, 2025
@jrieke
Copy link
Copy Markdown
Collaborator

jrieke commented May 23, 2025

Hey @wjkim00! Sorry for the long wait, coming back to this now. I think your proposed behavior for calling the parameter default and making the accepted value the same as the return value looks fine.

I know it's been a long time but are you still interested in finishing this up? If yes, it would be great if you could resolve the merge conflicts. Currently, there are some dependency conflicts when I try to run this locally, but once they are resolved, I'll try it out and make sure it works as expected. I'll also ping an engineer to do a more proper code review then.

@jrieke jrieke marked this pull request as draft September 18, 2025 23:32
@andreasntr
Copy link
Copy Markdown
Contributor

Hey @wjkim00! Sorry for the long wait, coming back to this now. I think your proposed behavior for calling the parameter default and making the accepted value the same as the return value looks fine.

I know it's been a long time but are you still interested in finishing this up? If yes, it would be great if you could resolve the merge conflicts. Currently, there are some dependency conflicts when I try to run this locally, but once they are resolved, I'll try it out and make sure it works as expected. I'll also ping an engineer to do a more proper code review then.

Hi @jrieke , i'll try to solve this myself since i opened the original issue and 99% of the work has been done. Thank you very much @wjkim00 ❤️

@andreasntr
Copy link
Copy Markdown
Contributor

andreasntr commented Sep 19, 2025

@jrieke opened #12578, rebased to the current develop

@vdonato
Copy link
Copy Markdown
Collaborator

vdonato commented Sep 23, 2025

Going to close this PR as it's superseded by #12578

@vdonato vdonato closed this Sep 23, 2025
sfc-gh-lwilby pushed a commit that referenced this pull request Sep 25, 2025
…12578)

## Describe your changes
Rebase with current develop w.r.t.
[#9658](https://github.com/streamlit/streamlit/pull/9658/files)
All credits to @wjkim00

## GitHub Issue Link (if applicable)

Closes #9469

## Testing Plan

- Explanation of why no additional tests are needed
- Unit Tests (JS and/or Python)
- E2E Tests
- Any manual testing needed?

---

**Contribution License Agreement**

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

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation do-not-merge PR is blocked from merging impact:users PR changes affect end users status:needs-product-approval PR requires product approval before merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow st.feedback to be instantiated with an initial value

7 participants