You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 lines
876 B

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = "\nimport React, { useRef, useEffect } from 'react';\nimport { useModel } from '../plugin-model/useModel';\nif (typeof useModel !== 'function') {\n throw new Error('[plugin-initial-state]: useModel is not a function, @umijs/plugin-model is required.')\n}\n\ninterface Props {\n children: React.ReactNode;\n}\nexport default (props: Props) => {\n const { children } = props;\n const appLoaded = useRef(false);\n const { loading = false } = useModel('@@initialState') || {};\n useEffect(()=>{\n if(!loading){\n appLoaded.current = true\n }\n }, [loading])\n // initial state loading \u65F6\uFF0C\u963B\u585E\u6E32\u67D3\n if (loading && !appLoaded.current) {\n return null;\n }\n return children;\n};\n";
exports.default = _default;