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)
25 lines
607 B
JavaScript
25 lines
607 B
JavaScript
import React, { useEffect, useRef } from "react";
|
|
import { usePlugins } from "@logics_configs";
|
|
|
|
if (typeof window !== "undefined") {
|
|
window.React = React;
|
|
}
|
|
|
|
export const PluginsController = () => {
|
|
const hasRunRef = useRef(false);
|
|
const {
|
|
loadAllPlugins,
|
|
asyncUpdatePluginInfoList,
|
|
} = usePlugins();
|
|
|
|
useEffect(() => {
|
|
if (!hasRunRef.current) {
|
|
asyncUpdatePluginInfoList().then(() => {
|
|
loadAllPlugins();
|
|
});
|
|
}
|
|
return () => hasRunRef.current = true;
|
|
}, []);
|
|
|
|
return null;
|
|
}; |