Skip to content

Handle unsaved dashboard changed when a user navigates away

Jiaan Louw requested to merge 410349-handle-unsaved-changes-on-navigation into master

What does this MR do and why?

This MR is based off Update customizable dashboard to handle unsaved... (!132114 - merged) and further updates the analytics dashboard to also handle unsaved changes when a user navigates away for [Bug] Handle unsaved changes in analytics dashb... (#410349 - closed).

The following changes are made:

  • Add a beforeunload event handler.
  • Add a beforeRouteLeave hook to the analytics dashboard.
  • Update specs.

Note: Product analytics is an experimental feature hidden behind a default off feature flag.

Note: The webpack runtime error is a known issue https://gitlab.slack.com/archives/C03M4R74NDU/p1695736698915219 (internal link).

Screenshots or screen recordings

Recording in chrome

Screen_Recording_2023-09-26_at_17.45.19

Firefox dialog

image

Safari dialog

image

How to set up and validate locally

  1. Be sure to run yarn when switching branch to have the correct @cubejs-client dependency installed
  2. Follow these instructions to setup Product Analytics in GDK.
  3. Onboard Product Analytics by setting up the feature at Project > Analytics > Analytics dashboards.
  4. Follow the alert prompt on Project > Analytics > Analytics dashboards to enable customizable dashboards.
  5. Navigate back to Project > Analytics > Analytics dashboards and click on New dashboard.
  6. Make some changes and click on the Analytics dashboards breadcrumb.
  7. Confirm that the confirmation modal is shown.
  8. Navigate again to the New dashboard view and make some changes.
  9. Click on any other link and confirm that the browser dialog is shown.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #410349 (closed)

Edited by Jiaan Louw

Merge request reports