feat: better cache some stuff

This commit is contained in:
2023-08-09 23:51:40 +02:00
parent 6587ee689b
commit 3232f14bf7
10 changed files with 153 additions and 177 deletions

View File

@ -1,5 +1,5 @@
import { Signal, useSignal } from "@preact/signals";
import { useRef } from "preact/hooks";
import { useEffect, useRef } from "preact/hooks";
import { useEventListener } from "@lib/hooks/useEventListener.ts";
import { menus } from "@islands/KMenu/commands.ts";
import { MenuEntry } from "@islands/KMenu/types.ts";

View File

@ -39,7 +39,7 @@ export const addMovieInfos: MenuEntry = {
};
state.activeMenu.value = menuID;
state.commandInput.value = "";
state.activeState.value = "normal";
},
visible: () => {

View File

@ -20,8 +20,6 @@ export const addSeriesInfo: MenuEntry = {
const json = await response.json() as TMDBSeries[];
console.log("Result", json);
const menuID = `result/${series.name}`;
state.menus[menuID] = {
@ -42,12 +40,8 @@ export const addSeriesInfo: MenuEntry = {
})),
};
await new Promise((res) => setTimeout(res, 20));
state.commandInput.value = "";
state.activeMenu.value = menuID;
await new Promise((res) => setTimeout(res, 20));
state.activeState.value = "normal";
},
visible: () => {