Description
This is an issue for discussion of frontend refactoring. @lafriks @silverwind
The code https://github.com/go-gitea/gitea/blob/main/web_src/js/features/repo-legacy.js#L350 works like this:
$(document).on('click', '.edit-content', async function (event) {
await createDropzone();
event.preventDefault();
});
// equal to
$(document).on('click', '.edit-content', function (event) {
return Promise.resolve(createDropzone).then(() => {
event.preventDefault();
});
});
The usage of async/await is incorrect. The preventDefault
won't have effect because the event has been processed synchronously before (when the listener returned).
So, that's why I insist to clean up most inconsistent await/async in the code base, only use them when it is necessary.
We should do our best to make everything work as expected.