triggerdotdev / jsonhero-web

JSON Hero is an open-source, beautiful JSON explorer for the web that lets you browse, search and navigate your JSON files at speed. 🚀. Built with 💜 by the Trigger.dev team.
https://jsonhero.io
Apache License 2.0
9.01k stars 482 forks source link

Notify if file is too big #186

Open notPlancha opened 1 month ago

notPlancha commented 1 month ago

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.