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.
36 lines
842 B
JavaScript
36 lines
842 B
JavaScript
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;
|
|
}; |