Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-582

Convert collection store into a proper reflux store with associated actions

    • Type: Icon: Task Task
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: Tech debt
    • None
    • Not Needed

      The standard reflux pattern is the unidirectional cycle from component to action to store to component.

      Currently the collection store (internal-packages/app/stores/collection.js) is not using this reflux pattern properly.

      Primary reason to do this ticket are two folds:

      • It is being used less as a store and more of a setter/getter in multiple different places, which breaks the reflux pattern
      • It currently sets the namespace, when it should listen to the namespace store instead (This was a challenge in completing COMPASS-548).

      There are two issues here:

      • collection index component sets active tab onto the store, which is accessed in a few different places via getActiveTab, which really isn't a clean pattern. The solution is to add an isActive property to the the tabs to flag whether it is visible/active/displayed or not
      • a collection dump from the instance store is being cached onto this collection store every time a new collection is viewed, only to access the 'readonly' property. The solution is to store instance state in the home store. The collection store gets a list of instance collections every time the home store changes, and sets a readonly status when namespace is a collection.

      Here are where the calls are being made:

      • getActiveTab
        • chart-builder
        • chart store
        • schema component
      • setCollection
        • databases-table
        • collections-table
        • sidebar-collection
        • sidebar-database
      • isReadonly
        • collectionStats store
        • document-list
        • compass-explain
        • explain store
        • indexes index-header component
        • indexes component
        • load-indexes store

      After this we can either get rid of the collection store or convert it to a proper store that lives in /internal-packages/collections/lib/store

            Assignee:
            Unassigned Unassigned
            Reporter:
            satyendra.sinha@mongodb.com Satyendra Sinha
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: