Skip to content
Snippets Groups Projects
Commit 4b953492 authored by timothycarambat's avatar timothycarambat
Browse files

Fix inifite loading when bad file is uploaded alone in uploader

parent d1ca16f7
No related branches found
No related tags found
No related merge requests found
......@@ -40,9 +40,11 @@ export default function UploadFile({
setFetchingUrl(false);
};
// Don't spam fetchKeys, wait 1s between calls at least.
const handleUploadSuccess = debounce(() => fetchKeys(true), 1000);
const handleUploadError = (_msg) => null; // stubbed.
// Queue all fetchKeys calls through the same debouncer to prevent spamming the server.
// either a success or error will trigger a fetchKeys call so the UI is not stuck loading.
const debouncedFetchKeys = debounce(() => fetchKeys(true), 1000);
const handleUploadSuccess = () => debouncedFetchKeys();
const handleUploadError = () => debouncedFetchKeys();
const onDrop = async (acceptedFiles, rejections) => {
const newAccepted = acceptedFiles.map((file) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment