Dataset validator: useReducer
The state logic in DatasetFilePreviewPage
is too complex to handle with useEffect()
. Multiple calls to update state are executed in the same callback (e.g. setFileData(data)
and setColumnStats(data[0])
in lines 77-78.
Since every such useEffect
triggers its own state change, multiple callbacks are executed and execute unnecessary API calls. The example below is a result of just selecting a column:
Update the code to use React.useReducer
instead.