refacotr(FE-438): Unsubscribe validate subscription and close drawer

This commit is contained in:
rstubryan
2025-12-26 19:17:12 +07:00
parent 517e8c758c
commit f58cb43801
2 changed files with 6 additions and 3 deletions
@@ -345,8 +345,11 @@ const UniformityForm = ({
setIsValid(true);
});
return unsub;
}, []);
return () => {
unsub();
useUiStore.getState().setExpandedDrawerOpen(false);
};
}, [subscribeValidate, setIsValid]);
// ===== EVENT HANDLERS =====
const handleOpenExpandedDrawer = () => {
+1 -1
View File
@@ -6,7 +6,7 @@ type MainUiSlice = {
type DrawerUISlice = {
triggerValidate: boolean;
toggleValidate: () => void;
subscribeValidate: (callback: () => void) => void;
subscribeValidate: (callback: () => void) => () => void;
isValid: boolean;
setIsValid: (v: boolean) => void;
subscribeIsValid: (callback: (isValid: boolean) => void) => () => void;