[Refactor/bugfix/TMP] TMP:
Separate plugins controller. Add ui pattern for outdated plugins and the plugin that is not supported current vrct version but supported in newest vrct version.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { usePlugins } from "@logics_configs";
|
||||
import clsx from "clsx";
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
window.React = React;
|
||||
window.clsx = clsx;
|
||||
}
|
||||
|
||||
export const LoadPluginsController = () => {
|
||||
|
||||
const {
|
||||
asyncLoadAllPlugins,
|
||||
currentIsInitializedLoadPlugin,
|
||||
updateIsInitializedLoadPlugin,
|
||||
} = usePlugins();
|
||||
|
||||
const asyncInitLoadPlugins = async () => {
|
||||
try {
|
||||
await asyncLoadAllPlugins();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (!currentIsInitializedLoadPlugin.data) {
|
||||
asyncInitLoadPlugins().then(() => {
|
||||
updateIsInitializedLoadPlugin(true);
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
};
|
||||
Reference in New Issue
Block a user