Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-28856

Modal dialogs expose code that is not null object safe

XMLWordPrintable

    • Moderate
    • No
    • False
    • Hide

      None

      Show
      None
    • Hide
      * Previously, when using the modal dialogs in a hook as part of the actions hook, an error occurs because the console framework will pass null objects as part of the render cycle. With this update, `getGroupVersionKindForResource` is now null safe and will return `undefined` if the `apiVersion` or `kind` are undefined. Additionally, the run time error for `useDeleteModal` no longer occurs, but note that it will not work with an `undefined` resource. (link:https://issues.redhat.com/browse/OCPBUGS-28856[*OCPBUGS-28856*])
      Show
      * Previously, when using the modal dialogs in a hook as part of the actions hook, an error occurs because the console framework will pass null objects as part of the render cycle. With this update, `getGroupVersionKindForResource` is now null safe and will return `undefined` if the `apiVersion` or `kind` are undefined. Additionally, the run time error for `useDeleteModal` no longer occurs, but note that it will not work with an `undefined` resource. (link: https://issues.redhat.com/browse/OCPBUGS-28856 [* OCPBUGS-28856 *])
    • Bug Fix
    • Done

      Description of problem:

      When using the modal dialogs in a hook as part of the actions hook (i.e. useApplicationsActionsProvider) the console will throw an error since the console framework will pass null objects as part of the render cycle. According to Jon Jackson, the console should be safe from null objects but it looks like the code for useDeleteModal and getGroupVersionKindForresource are not safe,

      Version-Release number of selected component (if applicable):

          

      How reproducible:

         Always 

      Steps to Reproduce:

          1. Use one of the modal APIs in an actions provider hook
          2.
          3.
          

      Actual results:

          Caught error in a child component: TypeError: Cannot read properties of undefined (reading 'split')
          at i (main-chunk-9fbeef79a…d3a097ed.min.js:1:1)
          at u (main-chunk-9fbeef79a…d3a097ed.min.js:1:1)
          at useApplicationActionsProvider (useApplicationActionsProvider.tsx:23:43)
          at ApplicationNavPage (ApplicationDetails.tsx:38:67)
          at na (vendors~main-chunk-8…87b.min.js:174297:1)
          at Hs (vendors~main-chunk-8…87b.min.js:174297:1)
          at Sc (vendors~main-chunk-8…87b.min.js:174297:1)
          at Cc (vendors~main-chunk-8…87b.min.js:174297:1)
          at _c (vendors~main-chunk-8…87b.min.js:174297:1)
          at pc (vendors~main-chunk-8…87b.min.js:174297:1) 

      Expected results:

          Works with no error

      Additional info:

          

            rhn-engineering-rhamilto Robb Hamilton
            gnunn@redhat.com Gerald Nunn
            YaDan Pei YaDan Pei
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: