mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-10 21:36:17 +00:00
fix: removing async promise
This commit is contained in:
@@ -19,7 +19,6 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-explicit-any": "warn",
|
||||
"no-async-promise-executor": "off",
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ const createDownloadSource = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
url: string
|
||||
) => {
|
||||
return HydraApi.post("/profile/download-sources", {
|
||||
await HydraApi.post("/profile/download-sources", {
|
||||
url,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -31,6 +31,7 @@ import { HydraCloudModal } from "./pages/shared-modals/hydra-cloud/hydra-cloud-m
|
||||
|
||||
import { injectCustomCss } from "./helpers";
|
||||
import "./app.scss";
|
||||
import { DownloadSource } from "@types";
|
||||
|
||||
export interface AppProps {
|
||||
children: React.ReactNode;
|
||||
@@ -139,12 +140,15 @@ export function App() {
|
||||
const syncDownloadSources = useCallback(async () => {
|
||||
const downloadSources = await window.electron.getDownloadSources();
|
||||
|
||||
const existingDownloadSources: DownloadSource[] =
|
||||
await downloadSourcesTable.toArray();
|
||||
|
||||
await Promise.allSettled(
|
||||
downloadSources.map(async (source) => {
|
||||
return new Promise(async (resolve) => {
|
||||
const existingDownloadSource = await downloadSourcesTable
|
||||
.where({ url: source.url })
|
||||
.first();
|
||||
return new Promise((resolve) => {
|
||||
const existingDownloadSource = existingDownloadSources.find(
|
||||
(downloadSource) => downloadSource.url === source.url
|
||||
);
|
||||
|
||||
if (!existingDownloadSource) {
|
||||
const channel = new BroadcastChannel(
|
||||
@@ -160,6 +164,8 @@ export function App() {
|
||||
resolve(true);
|
||||
channel.close();
|
||||
};
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user