Skip to content

Commit

Permalink
fix: app level toggle is now disabled during api call
Browse files Browse the repository at this point in the history
  • Loading branch information
sundasnoreen12 committed Nov 29, 2023
1 parent 4aa44b8 commit c0b5047
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/notification-preferences/NotificationPreferenceApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ 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();
const intl = useIntl();
const courseId = useSelector(selectSelectedCourseId());
const appPreferences = useSelector(selectPreferencesOfApp(appId));
const appToggle = useSelector(selectPreferenceAppToggleValue(appId));
const updatePreferencesStatus = useSelector(selectUpdatePreferencesStatus());

const preferences = useMemo(() => (
appPreferences.map(preference => (
Expand Down Expand Up @@ -49,6 +52,7 @@ const NotificationPreferenceApp = ({ appId }) => {
name={appId}
value={appToggle}
onChange={onChangeAppSettings}
disabled={updatePreferencesStatus === LOADING_STATUS}
/>
</span>
</div>
Expand Down

0 comments on commit c0b5047

Please sign in to comment.