Skip to content

Fix analytics dashboards Apollo cache issues causing duplicate items

Elwyn Benson requested to merge 425268-fix-buggy-apollo-cache-updates into master

What does this MR do and why?

Creating and then editing a new dashboard's title results in the both the old & new title being listed in the Analytics dashboards list.

Then when opening either of the duplicate dashboards shows the original title at the top of the dashboard.

Also when editing the panels on one of these dashboards the user can save the changes, but opening it back up renders the original state and the changes appear to be lost.

These issues are all the result of incorrect Apollo cache updates. The changes were always correctly saved to YML, but not reflected in the UI until refreshing the page (invalidating the incorrect Apollo cache).

This MR reworks the Apollo cache updating code to resolve these problems. It refactors to use the style recommended by the frontend guidelines.

Screenshots or screen recordings

Before After
apollo-cache-before apollo-cache-after

How to set up and validate locally

Steps to reproduce original bug from the issue:

  1. Follow these instructions to setup Product Analytics in GDK.

  2. On a project or instance with shared analytics dashboards enabled & custom dashboards configured.

  3. View the Project > Analytics > Analytics dashboards page.

  4. Create a new dashboard named dashboard-one.

  5. Go back to the dashboards list.

  6. Open the dashboard dashboard-one and edit its name to dashboard-two.

  7. Go back to the dashboards list.

  8. Observe that both dashboard-one and dashboard-two are listed.

  9. Open both dashboards and observe that both have the title dashboard-one when you'd expect dashboard-two.

  10. Go back to the dashboards list.

  11. Open dashboard-one and add some visualizations and click save.

  12. Go back to the dashboards list and open dashboard-one again.

  13. Observe that the changes made have been lost.

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 #425268 (closed)

Edited by Elwyn Benson

Merge request reports