[Perf/bugfix] Separate custom hooks and prevent re-render issues.

Config Page: Device Tab. threshold component. fix problem that the input component focused out when input something each time.
Set threshold data when started python.
This commit is contained in:
Sakamoto Shiina
2024-09-10 17:21:03 +09:00
parent 37989d5f7a
commit ac6b898a46
23 changed files with 514 additions and 443 deletions

View File

@@ -0,0 +1,14 @@
import { useSpeakerDeviceList as useStoreSpeakerDeviceList } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSpeakerDeviceList = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentSpeakerDeviceList, updateSpeakerDeviceList } = useStoreSpeakerDeviceList();
const getSpeakerDeviceList = () => {
updateSpeakerDeviceList(() => new Promise(() => {}));
asyncStdoutToPython("/controller/list_speaker_device");
};
return { currentSpeakerDeviceList, getSpeakerDeviceList, updateSpeakerDeviceList };
};