fix: resolve issue with Xpert unit summary toggle not updating state#85
Merged
Alam-2U merged 2 commits intorelease-ulmofrom Mar 20, 2026
Merged
fix: resolve issue with Xpert unit summary toggle not updating state#85Alam-2U merged 2 commits intorelease-ulmofrom
Alam-2U merged 2 commits intorelease-ulmofrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the Xpert Unit Summary settings toggle/state sync by aligning the frontend’s app/model identifier with the backend-provided id (xpert_unit_summary) and updating how settings are persisted when disabling.
Changes:
- Update the Xpert Unit Summary app id from
xpert-unit-summarytoxpert_unit_summaryacross app metadata, Settings wiring, thunks, and tests. - Change the settings submit behavior to always POST updates (persist
enabled: true/false) instead of deleting the record when disabling. - Update unit tests to use the new toggle DOM id and to exercise the new disable-via-POST behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| plugins/course-apps/xpert_unit_summary/settings-modal/SettingsModal.jsx | Persist disabled state via update thunk instead of deleting configuration. |
| plugins/course-apps/xpert_unit_summary/data/thunks.js | Align model ids with backend (xpert_unit_summary) for add/update/remove flows. |
| plugins/course-apps/xpert_unit_summary/appInfo.js | Update exported course app id to underscore format. |
| plugins/course-apps/xpert_unit_summary/Settings.jsx | Pass updated appId into the settings modal. |
| plugins/course-apps/xpert_unit_summary/Settings.test.jsx | Update selectors/expectations for new toggle id and disable behavior. |
Comments suppressed due to low confidence (1)
plugins/course-apps/xpert_unit_summary/Settings.test.jsx:125
- This test name/expectation combination is inconsistent: it says "disabled from backend" but asserts the enable toggle is checked and the enable badge is shown. If
enabled: falseis meant to represent a disabled state, this should assert the toggle is unchecked and the badge is not present (or rename the test to reflect that the toggle represents something other than the backendenabledflag).
test('Shows switch on if disabled from backend', async () => {
axiosMock.onGet(API.getXpertSettingsUrl(courseId))
.reply(200, generateCourseLevelAPIResponse({
success: true,
enabled: false,
}));
renderComponent();
await waitFor(() => expect(container.querySelector('#enable-xpert_unit_summary-toggle')).toBeTruthy());
expect(container.querySelector('#enable-xpert_unit_summary-toggle').checked).toBeTruthy();
expect(queryByTestId(container, 'enable-badge')).toBeTruthy();
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a2e0f5a to
dd9ed0c
Compare
naincy128
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Xpert Unit Summary toggle in Pages & Resources doesn't toggle between enable/disable .
Cause
Toggling OFF deletes the DB record, so the backend treats it as missing and returns enabled_by_default = true, making it impossible to disable in stage.
Ticket
COSMO2-841