nick-keller / react-datasheet-grid

An Airtable-like / Excel-like component to create beautiful spreadsheets.
MIT License
1.81k stars 171 forks source link

ref.current.selection bugs #137

Closed Alkimay closed 2 years ago

Alkimay commented 2 years ago

hey, so this object is being updated only when I press another row different from the current one. for example, if i am pressing cel 1,2 and then 1,4 its not updating, if i press 1,2 and then 2,* it is updating,

it seems like an easy fix could u please fix it?>

nick-keller commented 2 years ago

Thx I will look into it!

Alkimay commented 2 years ago

Thx I will look into it!

also, if u update the data from outside(by code or function) some row and on mouse/marker is on this row/cell its not rendering the value (it is changing the data), only when switching to other row its updates and renders the update

nick-keller commented 2 years ago

This is done on purpose, the text column uses an uncontrolled component while editing for performance. If you need a specific behavior you can create your own component.

nick-keller commented 2 years ago

Hello @Alkimay , I cannot reproduce this error, I assume it comes from your code. Here is what I did:

  const ref = useRef<DataSheetGridRef>(null)

  useEffect(() => {
    // Log selection every second
    setInterval(() => {
      console.log(ref.current?.selection)
    }, 1000)
  }, [])

  return <DataSheetGrid ref={ref} ... />

Can you please provide code to showcase the issue?