From c0b504763e1b47810dbd0ae8d25d7e0523bb032d Mon Sep 17 00:00:00 2001 From: sundasnoreen12 Date: Wed, 29 Nov 2023 22:57:04 +0500 Subject: [PATCH] fix: app level toggle is now disabled during api call --- src/notification-preferences/NotificationPreferenceApp.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/notification-preferences/NotificationPreferenceApp.jsx b/src/notification-preferences/NotificationPreferenceApp.jsx index 807cbfd15..89e2438f6 100644 --- a/src/notification-preferences/NotificationPreferenceApp.jsx +++ b/src/notification-preferences/NotificationPreferenceApp.jsx @@ -9,9 +9,11 @@ import { selectPreferenceAppToggleValue, selectPreferencesOfApp, selectSelectedCourseId, + selectUpdatePreferencesStatus, } from './data/selectors'; import NotificationPreferenceRow from './NotificationPreferenceRow'; import { updateAppPreferenceToggle } from './data/thunks'; +import { LOADING_STATUS } from '../constants'; const NotificationPreferenceApp = ({ appId }) => { const dispatch = useDispatch(); @@ -19,6 +21,7 @@ const NotificationPreferenceApp = ({ appId }) => { const courseId = useSelector(selectSelectedCourseId()); const appPreferences = useSelector(selectPreferencesOfApp(appId)); const appToggle = useSelector(selectPreferenceAppToggleValue(appId)); + const updatePreferencesStatus = useSelector(selectUpdatePreferencesStatus()); const preferences = useMemo(() => ( appPreferences.map(preference => ( @@ -49,6 +52,7 @@ const NotificationPreferenceApp = ({ appId }) => { name={appId} value={appToggle} onChange={onChangeAppSettings} + disabled={updatePreferencesStatus === LOADING_STATUS} />