Skip to content

Commit

Permalink
fix(plugins/plugin-client-common): in browser mode, tab offline may r…
Browse files Browse the repository at this point in the history
…esult in react loading error

part of kubernetes-sigs#7967
  • Loading branch information
starpit committed Sep 13, 2021
1 parent dec65a0 commit cb9462f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
*/

import React from 'react'
import { Alert, AlertActionCloseButton } from '@patternfly/react-core'

// ugh, avoid backdrop.css parse errors in plugin prescan
const Alert = React.lazy(() => import('@patternfly/react-core').then(_ => ({ default: _.Alert })))
const AlertActionCloseButton = React.lazy(() =>
import('@patternfly/react-core').then(_ => ({ default: _.AlertActionCloseButton }))
)

import { Props } from '..'
import '../../../../../web/scss/components/Alert/PatternFly.scss'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
import React from 'react'
import Props from './model'

const PatternFly = React.lazy(() => import('./impl/PatternFly'))
import PatternFly from './impl/PatternFly'

export { Props }

export default function AlertSpi(props: Props): React.ReactElement {
return <PatternFly {...props} />
return (
<React.Suspense fallback={<div />}>
<PatternFly {...props} />
</React.Suspense>
)
}

0 comments on commit cb9462f

Please sign in to comment.