Use a single source of truth for Clusters in CompassWeb

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Data Explorer
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • None
    • None
    • Developer Tools

      Currently, we have two separate sources of truth for Clusters in CompassWeb. One is in Compass:

      https://github.com/mongodb-js/compass/blob/main/packages/compass-web/sandbox/sandbox-connection-storage.tsx

      And another in MMS:

      https://github.com/10gen/mms/blob/ecab06ab7302f6c6b96ae52fd38f8dbb489c0351/client/packages/project/dataExplorerCompassWeb/router.tsx#L183

      These can get out of sync due to different refresh intervals, and when that happens, weird issues can occur, especially now that we are displaying non-connectable clusters in Compass Web.

      One example:
      A user opens Data Explorer, and then in another tab, they create a new cluster. Once the cluster finishes creating, it becomes connectable in CompassWeb. The user connects  and tries to create a new Database / collection. This causes a route change and re-render; However, when the page was first loaded, the new cluster did not exist and hence the MMS source of truth (useClusterDescriptions) does not contain it. As a result the user unexpectedly gets redirected to the home page: https://github.com/10gen/mms/blob/ecab06ab7302f6c6b96ae52fd38f8dbb489c0351/client/packages/project/dataExplorerCompassWeb/router.tsx#L109-L122 

      Note: it may appear that the clusterDescriptionsCache in MMS is being refreshed continuously:  https://github.com/10gen/mms/blob/ecab06ab7302f6c6b96ae52fd38f8dbb489c0351/client/packages/common/services/clusterDescriptionService.ts#L82

      However, in reality you will see that this doesn't actually happen. Haven't had time to dig into why, but I think it's because something needs to explicitly call startPolling, and that isn't happening anywhere.

            Assignee:
            Unassigned
            Reporter:
            Simon Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: