jsonhero-web icon indicating copy to clipboard operation
jsonhero-web copied to clipboard

Notify if file is too big

Open notPlancha opened this issue 1 year ago • 0 comments

Hi, I've been using the tool and it's great, however not being able to parse big jsons has been a pain. I looked at the code and removing the maxSize: 1024 * 1024 * 1 line or pasting the big json breaks on JSON.parse for some reason (related: https://github.com/triggerdotdev/jsonhero-web/issues/182). However I think it would be useful for users to be notified that the json isn't being processed when dragging and dropping or selecting the json.

This seems possible to do with useDropzone on DragAndDropForm.tsx:

const { getRootProps, getInputProps, isDragActive } = useDropzone({
  onDropAccepted: onDrop,
  onDropRejected: (fileRejections) => {
    alert("File rejected: " + fileRejections[0].errors[0].message)
    console.log(fileRejections);
  },
  ...
});

I'm using alert just as an example, but this alone would improve feedback.

notPlancha avatar May 23 '24 15:05 notPlancha