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,
|
||||
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;
|
||||
|
@ -222,7 +222,6 @@ const PureHome = (props) => {
|
||||
loadCurrentUser,
|
||||
updateProfileCulture,
|
||||
getRooms,
|
||||
setIsLoading,
|
||||
isLoading,
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user