chakra-ui / ark

Ark UI is a headless UI library with over 45+ components designed to build scalable Design Systems that works for a wide range of JS frameworks.
https://ark-ui.com
MIT License
3.83k stars 113 forks source link

Splitter - Set-Size example buggy / crashes #2602

Open sparecycles opened 5 months ago

sparecycles commented 5 months ago

Description

When I do api().setSize("a", 10) I expect the panel to get resized to 10% of the size.

It doesn't do that consistently, just hitting the buttons makes the UI unresponsive.

Additionally: resizing a panel to under 10% and then setting the size to 10% throws an exception that the total is over 100%: this breaks mouseover of the handle since state.context becomes undefined.

Link to Reproduction (or Detailed Explanation)

(video)

Steps to Reproduce

https://github.com/chakra-ui/ark/assets/719818/2dd3d1e8-f857-45cd-82f6-40cd8c31f2b7

(Code from https://ark-ui.com/react/docs/components/splitter)

import { Splitter } from '@ark-ui/solid'

export const RenderProp = () => (
  <Splitter.Root
    size={[
      { id: 'a', size: 50 },
      { id: 'b', size: 50 },
    ]}
  >
    <Splitter.Context>
      {(api) => (
        <>
          <Splitter.Panel id="a">
            <button type="button" onClick={() => api().setSize('a', 10)}>
              Set to 10%
            </button>
          </Splitter.Panel>
          <Splitter.ResizeTrigger id="a:b" />
          <Splitter.Panel id="b">
            <button type="button" onClick={() => api().setSize('b', 10)}>
              Set to 10%
            </button>
          </Splitter.Panel>
        </>
      )}
    </Splitter.Context>
  </Splitter.Root>
)

Ark UI Version

3.3.0

Framework

Browser

Electron 29.1.5

Additional Information

No response

xeinebiu commented 1 month ago

This issue does mention ArkUI 3.3.0, its really old version per my opinion.

sparecycles commented 1 month ago

Oh? I may try to reproduce it this weekend with current v4.2.0.

Jdyn commented 2 weeks ago

Hey @segunadebayo any update on this? We're still encountering this, which is further described in #2967.

Still occurs on the latest version.