[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user