react-spreadsheet icon indicating copy to clipboard operation
react-spreadsheet copied to clipboard

type error on onChange prop, and nextjs router malfunctioning

Open dmm22 opened this issue 3 years ago • 1 comments

I have a nextjs page with a Spreadsheet component on it. If I add the onChange prop, I get a type error:

Type 'Dispatch<SetStateAction<{ value: ""; }[][] | undefined>>' is not assignable to type '(data: Matrix<{ value: ""; }>) => void'.
  Types of parameters 'value' and 'data' are incompatible.
    Type 'Matrix<{ value: ""; }>' is not assignable to type 'SetStateAction<{ value: ""; }[][] | undefined>'.
      Type '({ value: ""; } | undefined)[][]' is not assignable to type '{ value: ""; }[][]'.

As soon as I edit the spreadsheet, that component gets rendered on all pages. Idk, it totally breaks the router whenever I actually try to change state with it. Any ideas?

Here's a stack overflow post with a lot more detail:

https://stackoverflow.com/questions/71975915/router-changes-url-without-changing-the-component

dmm22 avatar Apr 24 '22 23:04 dmm22

Hey dmm22, thank you for giving React Spreadsheet a spin! Can you provide a CodeSandbox that reproduces the issue?

iddan avatar Apr 25 '22 05:04 iddan