Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Dec 17, 2024

Describe your changes

Fixes an issue with the dataframe width being ignored if a different height was also provided (caused by wrong usage of setting state in effects based on the previous state).

GitHub Issue Link (if applicable)

Testing Plan

  • Add e2e test.

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 added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Dec 17, 2024
@lukasmasuch lukasmasuch marked this pull request as ready for review December 17, 2024 14:52
}
}),
[
columns,
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: This would have been caught by our tooling if it didn't have disabled eslint rules. Can we refactor this so that the callback definition adheres to the rules of hooks?

Copy link
Collaborator Author

@lukasmasuch lukasmasuch Dec 17, 2024

Choose a reason for hiding this comment

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

Sounds good 👍 I split it up in a way that allows full dependency inspection (+ remove the related eslint disables). However, the only way I found that fully allows this without breaking the debounce functionality is by splitting it into two callbacks and a memo. I will likely move this refactor into a dedicated PR since it might need some more thoughts and iteration and will do it for syncSelectionState + syncEditingState.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah sounds good. I think a good outcome of that refactor would be if we could have a shared useDebouncedCallback hook that handles this for us since I'm sure it'll be useful in many other places outside of this file too!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, agree that a useDebouncedCallback hook would be useful. I moved the related changes to this PR: #10044

@lukasmasuch lukasmasuch enabled auto-merge (squash) December 18, 2024 15:49
@lukasmasuch lukasmasuch merged commit 87f1289 into develop Dec 18, 2024
32 checks passed
edegp pushed a commit to edegp/streamlit that referenced this pull request Jan 19, 2025
## Describe your changes

Fixes an issue with the dataframe width being ignored if a different
height was also provided (caused by wrong usage of setting state in
effects based on the previous state).

## GitHub Issue Link (if applicable)

- Closes streamlit#9762

## Testing Plan

- Add e2e test.

---

**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 fix/dataframe-width-ignored-issue branch March 5, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

st.dataframe width is buggy (defers to previous df width) when height parameter is also used..

3 participants