Home: useSDK: Fixed effect flow. Fixed calling load command
This commit is contained in:
parent
8224f32330
commit
b76b3abc68
@ -17,7 +17,6 @@ const useSDK = ({
|
|||||||
createRoom,
|
createRoom,
|
||||||
refreshFiles,
|
refreshFiles,
|
||||||
setViewAs,
|
setViewAs,
|
||||||
|
|
||||||
getSettings,
|
getSettings,
|
||||||
logout,
|
logout,
|
||||||
login,
|
login,
|
||||||
@ -27,7 +26,6 @@ const useSDK = ({
|
|||||||
loadCurrentUser,
|
loadCurrentUser,
|
||||||
updateProfileCulture,
|
updateProfileCulture,
|
||||||
getRooms,
|
getRooms,
|
||||||
setIsLoading,
|
|
||||||
isLoading,
|
isLoading,
|
||||||
}) => {
|
}) => {
|
||||||
const handleMessage = async (e) => {
|
const handleMessage = async (e) => {
|
||||||
@ -171,24 +169,7 @@ const useSDK = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// if (window.parent && !frameConfig) {
|
|
||||||
// frameCallCommand("setConfig");
|
|
||||||
// }
|
|
||||||
|
|
||||||
const callCommandLoad = useCallback(
|
|
||||||
() => frameCallCommand("setIsLoaded"),
|
|
||||||
[frameCallCommand]
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTimeout(() => {
|
|
||||||
if (isLoading) {
|
|
||||||
callCommandLoad("setIsLoaded");
|
|
||||||
}
|
|
||||||
}, 750);
|
|
||||||
}, [callCommandLoad, isLoading]);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
window.addEventListener("message", handleMessage, false);
|
window.addEventListener("message", handleMessage, false);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
@ -196,9 +177,13 @@ const useSDK = ({
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
frameCallCommand("setConfig");
|
frameCallCommand("setConfig");
|
||||||
}, [frameConfig?.frameId]);
|
}, [frameConfig?.frameId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isLoading) frameCallCommand("setIsLoaded");
|
||||||
|
}, [isLoading]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useSDK;
|
export default useSDK;
|
||||||
|
@ -222,7 +222,6 @@ const PureHome = (props) => {
|
|||||||
loadCurrentUser,
|
loadCurrentUser,
|
||||||
updateProfileCulture,
|
updateProfileCulture,
|
||||||
getRooms,
|
getRooms,
|
||||||
setIsLoading,
|
|
||||||
isLoading,
|
isLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user