I discovered the new playground and love using it! I'm super grateful for all the hard work. 😊
However, I found a drag issue after resizing the playground.
After resizing the window, the layout switches between Row and Column as expected. However, dragging the code separator does not correctly adjust the dimensions of the elements based on the new layout because it does not use latest layout value.
Suggestion
Add the layout in useEffect dependencies
It causes effect run again when layout is changed
Use a ref to store the latest layout value
Additonal effect to update the ref
let (layout, setLayout) = React.useState(...)
let layoutRef = React.useRef(layout)
I discovered the new playground and love using it! I'm super grateful for all the hard work. 😊 However, I found a drag issue after resizing the playground.
https://github.com/rescript-association/rescript-lang.org/assets/47740690/d531af5d-6505-40f8-bb1a-8ad7dd38d091
After resizing the window, the layout switches between Row and Column as expected. However, dragging the code separator does not correctly adjust the dimensions of the elements based on the new layout because it does not use latest layout value.
Suggestion
Add the layout in useEffect dependencies It causes effect run again when layout is changed
Use a ref to store the latest layout value Additonal effect to update the ref
React.useEffect(() => { layoutRef.current = layout }, [layout])