[Update/Refactor] Fetch and show the plugins info list.

Refactor some functions.
Try to fetch functions from github api just once when vrct started.(It used to every time plugin tab has opened so easy to reach to the api limit)
This commit is contained in:
Sakamoto Shiina committed 2025-03-13 12:19:35 +09:00
1 parent 77795192a0
commit b0f5751e11
17 files changed
+350 -237

No files matched your search

@@ -1,15 +1,24 @@
import React, { useEffect, useRef } from "react";
import { usePlugins } from "@logics_configs";
import React, { useEffect } from "react";
if (typeof window !== "undefined") {
window.React = React;
}
export const PluginsController = () => {
const { loadAllPlugins } = usePlugins();
const hasRunRef = useRef(false);
const {
loadAllPlugins,
asyncUpdatePluginInfoList,
} = usePlugins();
useEffect(() => {
loadAllPlugins();
if (!hasRunRef.current) {
asyncUpdatePluginInfoList().then(() => {
loadAllPlugins();
});
}
return () => hasRunRef.current = true;
}, []);
return null;