Skip to content

Commit

Permalink
🐛 Fix infinite loading on drop file (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisfelipesdn12 authored Jun 5, 2021
1 parent 51d5662 commit a61d6ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ Discord Data Package Explorer is built with **[Svelte](https://svelte.dev)**, an
* Clone the repository.
* Install the dependencies using `npm install` or `yarn install`.
* Start the app using `npm run dev` or `yarn dev`!

> Note: for testing purposes, you may append `?demo` to the URL to use the mocked data.
8 changes: 7 additions & 1 deletion src/views/Loader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@
event.preventDefault();
}
/** @see https://developer.mozilla.org/en-US/docs/Web/API/Document/drop_event */
function handleDrop (event) {
event.preventDefault();
handleFile(event.dataTransfer.items[0].getAsFile());
if (event.dataTransfer.items[0].getAsFile() !== null) {
handleFile(event.dataTransfer.items[0].getAsFile());
} else {
error = 'Error trying to handle the dropped file. Try clicking instead.';
}
}
function filePopup (event) {
Expand Down

0 comments on commit a61d6ea

Please sign in to comment.