Skip to content

Maximum update depth exceeded: React warning occasionally #279

@rmrbytes

Description

@rmrbytes

The console occasionally shows the following warning indicating some sort of infinite rendering. The error message is:

Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.

I am using this wonderful component in the following manner. Key code has been shown

// component
import ...

const Component = (props) => {

  useEffect(() => {
    const populateSheet = () => {
         // logic to read props data and put it into array
        // required by SS
       return data
    }
    setData(populateSheet())
  }, [])

  return (
     <Spreadsheet
            hideColumnIndicators={true}
            hideRowIndicators={true}
            data={data}
            onChange={setData} />
   )   
}

I find that the error shows up when I blank out a cell in the spreadsheet. Not everytime but occasionally. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions