From 2ca2e37250f1e706af4cfbf0e85e3692082a6456 Mon Sep 17 00:00:00 2001 From: Samuel Padgett Date: Sat, 17 Aug 2019 10:20:32 -0400 Subject: [PATCH] Don't use AsyncComponent PF3 Switch This creates a separate bundle with all of PF3 and breaks tree-shaking. Removing the AsyncComponent doesn't increase the main vendor bundle size. --- .../operator-lifecycle-manager/create-operand.tsx | 6 +++--- .../operator-lifecycle-manager/descriptors/spec/index.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/public/components/operator-lifecycle-manager/create-operand.tsx b/frontend/public/components/operator-lifecycle-manager/create-operand.tsx index 077648d2d95..4482fc4f47f 100644 --- a/frontend/public/components/operator-lifecycle-manager/create-operand.tsx +++ b/frontend/public/components/operator-lifecycle-manager/create-operand.tsx @@ -6,6 +6,7 @@ import { safeDump } from 'js-yaml'; import * as _ from 'lodash-es'; import { PropertyPath } from 'lodash'; import * as classNames from 'classnames'; +import { Switch } from 'patternfly-react'; import { Alert, ActionGroup, Button } from '@patternfly/react-core'; import { JSONSchema6TypeName } from 'json-schema'; @@ -27,7 +28,7 @@ import { import { ClusterServiceVersionKind, referenceForProvidedAPI, providedAPIsFor, CRDDescription, ClusterServiceVersionLogo, APIServiceDefinition } from './index'; import { ClusterServiceVersionModel, CustomResourceDefinitionModel } from '../../models'; import { Firehose } from '../utils/firehose'; -import { NumberSpinner, StatusBox, BreadCrumbs, history, SelectorInput, ListDropdown, AsyncComponent, resourcePathFromModel, FirehoseResult, useScrollToTopOnMount } from '../utils'; +import { NumberSpinner, StatusBox, BreadCrumbs, history, SelectorInput, ListDropdown, resourcePathFromModel, FirehoseResult, useScrollToTopOnMount } from '../utils'; import { SpecCapability, StatusCapability, Descriptor } from './descriptors/types'; import { ResourceRequirements } from './descriptors/spec/resource-requirements'; import { RootState } from '../../redux'; @@ -330,8 +331,7 @@ export const CreateOperandForm: React.FC = (props) => { onChange={({currentTarget}) => setFormValues(values => ({...values, [field.path]: currentTarget.checked}))} />; } if (field.capabilities.includes(SpecCapability.booleanSwitch)) { - return import('patternfly-react').then(m => m.Switch)} + return setFormValues(values => ({...values, [field.path]: val}))} onText="True" diff --git a/frontend/public/components/operator-lifecycle-manager/descriptors/spec/index.tsx b/frontend/public/components/operator-lifecycle-manager/descriptors/spec/index.tsx index 8863c349f00..9b4c0168b65 100644 --- a/frontend/public/components/operator-lifecycle-manager/descriptors/spec/index.tsx +++ b/frontend/public/components/operator-lifecycle-manager/descriptors/spec/index.tsx @@ -2,12 +2,13 @@ import * as React from 'react'; import * as _ from 'lodash-es'; import { Map as ImmutableMap } from 'immutable'; import { Tooltip } from '@patternfly/react-core'; +import { Switch } from 'patternfly-react'; import { SpecCapability, DescriptorProps, CapabilityProps } from '../types'; import { ResourceRequirementsModalLink } from './resource-requirements'; import { EndpointList } from './endpoint'; import { configureSizeModal } from './configure-size'; -import { Selector, ResourceLink, LoadingInline, AsyncComponent } from '../../../utils'; +import { Selector, ResourceLink, LoadingInline } from '../../../utils'; import { k8sPatch } from '../../../../module/k8s'; import { YellowExclamationTriangleIcon } from '@console/shared'; @@ -55,8 +56,7 @@ const BooleanSwitch: React.FC = (props) => { }; return
- import('patternfly-react').then(m => m.Switch)} + { setValue(val);