Home: useSDK: Fixed effect flow. Fixed calling load command

This commit is contained in:
Ilya Oleshko 2024-01-18 13:56:33 +03:00
parent 8224f32330
commit b76b3abc68
2 changed files with 5 additions and 21 deletions

View File

@ -17,7 +17,6 @@ const useSDK = ({
createRoom,
refreshFiles,
setViewAs,
getSettings,
logout,
login,
@ -27,7 +26,6 @@ const useSDK = ({
loadCurrentUser,
updateProfileCulture,
getRooms,
setIsLoading,
isLoading,
}) => {
const handleMessage = async (e) => {
@ -171,24 +169,7 @@ const useSDK = ({
}
};
// if (window.parent && !frameConfig) {
// frameCallCommand("setConfig");
// }
const callCommandLoad = useCallback(
() => frameCallCommand("setIsLoaded"),
[frameCallCommand]
);
useEffect(() => {
setTimeout(() => {
if (isLoading) {
callCommandLoad("setIsLoaded");
}
}, 750);
}, [callCommandLoad, isLoading]);
React.useEffect(() => {
window.addEventListener("message", handleMessage, false);
return () => {
@ -196,9 +177,13 @@ const useSDK = ({
};
}, []);
React.useEffect(() => {
useEffect(() => {
frameCallCommand("setConfig");
}, [frameConfig?.frameId]);
useEffect(() => {
if (!isLoading) frameCallCommand("setIsLoaded");
}, [isLoading]);
};
export default useSDK;

View File

@ -222,7 +222,6 @@ const PureHome = (props) => {
loadCurrentUser,
updateProfileCulture,
getRooms,
setIsLoading,
isLoading,
});