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

Splitter: Non optimal handling of splitter sizing #3483

Closed
kalinkrustev opened this issue Oct 18, 2022 · 0 comments · Fixed by #3482
Closed

Splitter: Non optimal handling of splitter sizing #3483

kalinkrustev opened this issue Oct 18, 2022 · 0 comments · Fixed by #3482
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@kalinkrustev
Copy link
Contributor

Describe the bug

There are actually 3 issues in the original code of version 8.6.1

  • state is saved in storage without ever moving the splitter
  • sizes are lost on re-render
  • if the splitter is moved too far, sizes bigger than 100% and smaller than 0% set and even saved

Reproducer

https://codesandbox.io/s/primereact-test-forked-wu3cyg?file=/src/index.js

PrimeReact version

8.6.1

React version

18.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Open the reproducer URL
  2. Click the button before any resizing - observe sizes are saved in local storage
  3. Resize the splitter, then click the button - sizes are lost (also observed in local storage)
  4. Move the splitter to the left beyond the edge - invalid sizes are set (also observed in local storage)

Expected behavior

  • Sizes should not be persisted unless resizing is performed
  • Changing the stateKey or stateStorage properties on already mounted splitter should trigger reloading the sizes
  • Sizes below 0% or above 100% should not be set
@kalinkrustev kalinkrustev added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 18, 2022
@melloware melloware added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 18, 2022
@melloware melloware added this to the 8.6.2 milestone Oct 18, 2022
melloware pushed a commit that referenced this issue Oct 18, 2022
* Fix #3413: Splitter restoreState dependencies

* fix: move Splitter panel sizes in state

* chore: prettier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants