amantiwari1/youtube-downloader-desktop

async and await in loops doesn't work in card loading

amantiwari1 opened this issue · 5 comments

I have tried promise, await for loop, async, and await doesn't work in input.py

let me explain below

in line 83 in input.py

for await (URL of AllUrl) {
 
dispatch({ type: 'CardLoading', data: true }); //  it should be true so append loading in oneVideo function
 // some code
}

dispatch({ type: 'CardLoading', data: false });  // once it is done then it should be false remove loading but 

the result is remove loading in 1 sec without show loading in the frontend

can't figure out how to fix it? can you fix it? @raulpy271

I don't understand what's the problem. Can you explain to me?

Why do you need to use async operation? Which statement is a promise?

if the user taps the add button with more than Two URL then it shows loading after added one card then it has suddenly gone loading while it is adding another card which user doesn't know it is adding card or not after 1 sec it append new card
that's issue

That's okay, I will try to reproduce on my machine. Another question, some of these statements are Promises? If not then we don't need to use await, because it's to be used in async operations.

the promise is like then/catch i wrote code but it doesn't work so I deleted it