question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dashboard sharing modal state is preserved after closing

See original GitHub issue

Feature 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 rollbackSharingSettings with does not have any parameters and returns the type set to a new constant ROLLBACK_SHARING_SETTINGS and an empty payload.
    • The reducer should set sharingSettings to state.savedSharingSettings which are the original saved settings.
  • Using assets/js/components/dashboard-sharing/DashboardSharingSettings/Footer.js,
    • Dispatch the rollbackSharingSettings action within the onCancel function if the sharing settings have changed.
      • To know if the sharing settings have changed, query the haveSharingSettingsChanged selector of the core/modules data store.

Test Coverage

  • Add new tests for the rollbackSharingSettings action.

QA Brief

  • Enable the dashboardSharing feature 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:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
hussain-tcommented, Jun 23, 2022

@nfmohit, The expected scenario tests are supposed to be done in the DashboardSharingSettingsButton component. 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 the DashboardSharingSettingsButton component. My point for adding a test is to have bulletproof testing coverage.

1reaction
nfmohitcommented, Jun 22, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap modal makes scrollbar disappear after closing
I am using a modal for logging in in Meteor (eg. using Facebook login service). And a callback is triggered when the login...
Read more >
Best Practices for Modals / Overlays / Dialog Windows
When they first came on the scene, modal windows were an elegant solution ... Closing the Dialog — Each overlay window must have...
Read more >
Build a complete Modal Component with React Hooks
The goal is to include any content to the modal and to manage the opening and closing of the component. React Modal Hooks....
Read more >
Improve modal management in React with nice-modal-react
Closing modals is independent of the rest of the code, ... The state of the input will be stored in the state variable...
Read more >
Save UI states - Android Developers
Depending upon the action a user takes, they either expect that activity state to be cleared or the state to be preserved.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found