Dashboard sharing modal state is preserved after closing
See original GitHub issueFeature Description
Bug bash issue: https://app.asana.com/0/1202258919887896/1202436389160092 please refer to Asana issue for background
Similar to module settings which rollback to the initial/saved values/states when saved or exiting edit mode, the sharing settings modal should follow a similar pattern and start from a fresh state every time it is opened.
This means the “current” sharing settings should rollback to the saved values (we already have savedSharingSettings in state for this) and any other UI state should be reset as well (whether or not the user role select is in edit mode, no rows should be disabled, scroll position etc).
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When the Dashboard Sharing settings modal is closed, all of its settings should be rolled back to the current saved values and any other component/UI state should be reset to their initial values.
Note: The implementation should follow a similar pattern to the way module settings work (see rollbackSettings)
Implementation Brief
- Using
assets/js/googlesitekit/modules/datastore/sharing-settings.js,- Add a new action
rollbackSharingSettingswith does not have any parameters and returns thetypeset to a new constantROLLBACK_SHARING_SETTINGSand an emptypayload. - The reducer should set
sharingSettingstostate.savedSharingSettingswhich are the original saved settings.
- Add a new action
- Using
assets/js/components/dashboard-sharing/DashboardSharingSettings/Footer.js,- Dispatch the
rollbackSharingSettingsaction within theonCancelfunction if the sharing settings have changed.- To know if the sharing settings have changed, query the
haveSharingSettingsChangedselector of thecore/modulesdata store.
- To know if the sharing settings have changed, query the
- Dispatch the
Test Coverage
- Add new tests for the
rollbackSharingSettingsaction.
QA Brief
- Enable the
dashboardSharingfeature flag using the tester plugin. - Go to the Site Kit Dashboard.
- Open the Dashboard Sharing settings modal.
- Make some changes to the roles and management, but do not save.
- Close the modal.
- Open the modal back again, make sure the unsaved settings aren’t preserved and have been reset to the previously saved settings.
Changelog entry
- Rollback any unsaved changes to dashboard sharing settings when closing the dialog.
Issue Analytics
- State:
- Created a year ago
- Comments:6

Top Related StackOverflow Question
@nfmohit, The expected scenario tests are supposed to be done in the
DashboardSharingSettingsButtoncomponent. However, I just realized that we don’t have a test file for that component. So, I think it’s out of the scope to add tests for theDashboardSharingSettingsButtoncomponent. My point for adding a test is to have bulletproof testing coverage.Thank you for the kind review @hussain-t! I have already fixed the first issue that you mentioned in the meantime, and am now working on the test case. I’ll follow-up once done.