Uploaded image for project: 'OpenShift Console'
  1. OpenShift Console
  2. CONSOLE-3147

ToolbarFilter - Improper State Management Refactor

    XMLWordPrintable

Details

    • 8
    • False
    • None
    • False

    Description

      While addressing a bug (https://bugzilla.redhat.com/show_bug.cgi?id=2070720), it was revealed that the ToolbarFilter violates React data management principles.

      ToolbarFilter manages state in one or many on these ways:

      • Through the URL
      • Through an external hook that filters the data provided to the nearby table
      • Through Redux

      In almost all cases, the filter settings are stored in their place(s) of importance and applied to the data that is used in a nearby table. In all cases they are never returned back to the filter component from that source of truth. There are sometimes other components pulling this data but it's not returned to the component. A URL parser is used to grab the data and repopulate the component with the filter settings.

      Due to this violation of React principles of single source of truth in React for the data, the code behaves extremely poorly to adjustments to the URL without React remounting the component. Ie, when you click on the navigation item to re-route back to the base page without any of the URL params. See the bug for more details.

      Acceptance Criteria

      • Refactor multiple instances where this component, ToolbarFilter, is used to properly provide the state along with any impacted data.
      • Properly update the code to handle pulling from the URL and invoking handlers so the caller's source of truth can be aligned with the URL
      • Remove hack-fixes hooks that were added with the bug

      Attachments

        Activity

          People

            Unassigned Unassigned
            aballantyne Andrew Ballantyne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: