[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:
14
src-ui/logics/configs/useSoftwareVersion.js
Normal file
14
src-ui/logics/configs/useSoftwareVersion.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useSoftwareVersion as useStoreSoftwareVersion } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSoftwareVersion = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSoftwareVersion, updateSoftwareVersion } = useStoreSoftwareVersion();
|
||||
|
||||
const getSoftwareVersion = () => {
|
||||
updateSoftwareVersion(() => new Promise(() => {}));
|
||||
asyncStdoutToPython("/config/version");
|
||||
};
|
||||
|
||||
return { currentSoftwareVersion, getSoftwareVersion, updateSoftwareVersion };
|
||||
};
|
||||
Reference in New Issue
Block a user