You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a problem that can not be repeated consistently,I don't know if it's the code or the recoil
Here's the thing
under normal circumstances
under abnormal circumstances,sees left menu is not display,the second "GlobalMenu suspendVisible" is not console
exportconstmenuConfigAtom=atom<{fixed?: boolean;suspendVisible?: boolean;extendVisible?: boolean;}>({key: 'ocean_menu_config',default: {fixed: localStorage.getItem(`${OCEAN_PREFIX}_menu_fixed`)==='true'},});/** 菜单相关展示配置 */exportconstmenuConfigSelector=selector({key: 'ocean_menu_config_selector',get: ({ get })=>get(menuConfigAtom),1set: ({ set },newValue)=>{if(newValueinstanceofDefaultValue){return;}set(menuConfigAtom,newValue);if(!newValue.extendVisible){set(navSearchKeywordAtom,'');set(navSortAtom,false);}},});exportfunctionuseMenuVisible(){const[iconRef,isIconHovered]=useHover<HTMLDivElement>();const[menuRef,isMenuHovered]=useHover<HTMLDivElement>();constsetMenuConfig=useSetRecoilState(menuConfigSelector);constnavType=useNavType();const{ run }=**useDebounceFn**(visible=>{setMenuConfig(pre=>{console.log('----',pre,visible);return{
...pre,suspendVisible: visible,
...(!visible ? {extendVisible: visible} : {}),};});},100);useEffect(()=>{if(isIconHovered||isMenuHovered){run(true);}if(!(isIconHovered||isMenuHovered)){run(false);}},[isIconHovered,isMenuHovered,navType]);return{ iconRef, menuRef };}
the menu button on the top and the control of the left menu display are both suspendedVisible variables, and they both use useRecoilState to retrieve data
Did I guess it right that it was caused by the left menu component not being triggered?,by the way, I used debounce to control the change of "menuconfig" data. Is this related to it? and i use "React.forwardRef", Is this related to it?
The text was updated successfully, but these errors were encountered:
There is also an issue with using a selector elsewhere, where after changing the data, using useRecoilValue(xxxSelector) returns undefined, while using the atom directly retrieves the latest value and triggers component rendering.
Sometimes useRecoilValue(currentAppSelector) fails to retrieve the value, while using useRecoilValue(currentAppAtom) seems to work fine. As this is an intermittent issue, it cannot be confirmed entirely if it is normal.
exportconstcurrentAppAtom=atom<string>({key: 'ocean_current_app',default: '',});exportconstcurrentAppSelector=selector({key: 'ocean_current_app_selector',get: ({ get })=>get(currentAppAtom),set: ({ set },name)=>{if(nameinstanceofDefaultValue){return;}set(currentAppAtom,appKey);},});
This is a problem that can not be repeated consistently,I don't know if it's the code or the recoil
Here's the thing
under normal circumstances
under abnormal circumstances,sees left menu is not display,the second "GlobalMenu suspendVisible" is not console
the menu button on the top and the control of the left menu display are both suspendedVisible variables, and they both use useRecoilState to retrieve data
Did I guess it right that it was caused by the left menu component not being triggered?,by the way, I used debounce to control the change of "menuconfig" data. Is this related to it? and i use "React.forwardRef", Is this related to it?
The text was updated successfully, but these errors were encountered: