From 754aa740d4a1471a08ba819296fdc2c0525b44ba Mon Sep 17 00:00:00 2001 From: Don Date: Mon, 24 Oct 2022 20:05:43 +0000 Subject: [PATCH] clean onInit --- .../AddJsCssReferenceWebPart.ts | 22 ++++++------------- .../components/AddJsCssReference.tsx | 1 - .../components/IAddJsCssReferenceProps.ts | 6 ----- 3 files changed, 7 insertions(+), 22 deletions(-) delete mode 100644 samples/react-add-js-css-ref/src/webparts/addJsCssReference/components/IAddJsCssReferenceProps.ts diff --git a/samples/react-add-js-css-ref/src/webparts/addJsCssReference/AddJsCssReferenceWebPart.ts b/samples/react-add-js-css-ref/src/webparts/addJsCssReference/AddJsCssReferenceWebPart.ts index 20e8282e1..01b712004 100644 --- a/samples/react-add-js-css-ref/src/webparts/addJsCssReference/AddJsCssReferenceWebPart.ts +++ b/samples/react-add-js-css-ref/src/webparts/addJsCssReference/AddJsCssReferenceWebPart.ts @@ -2,14 +2,12 @@ import * as React from 'react'; import * as ReactDom from 'react-dom'; import { Version } from '@microsoft/sp-core-library'; import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base"; -import { IPropertyPaneConfiguration, PropertyPaneTextField } from "@microsoft/sp-property-pane"; +import { IPropertyPaneConfiguration } from "@microsoft/sp-property-pane"; import * as strings from 'AddJsCssReferenceWebPartStrings'; -import AddJsCssReference from './components/AddJsCssReference'; -import { IAddJsCssReferenceProps } from './components/IAddJsCssReferenceProps'; +import AddJsCssReference, { IAddJsCssReferenceProps } from './components/AddJsCssReference'; import { getSP } from './pnpjsConfig'; export interface IAddJsCssReferenceWebPartProps { - description: string; } export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart { @@ -18,7 +16,6 @@ export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart = React.createElement( AddJsCssReference, { - description: this.properties.description, context: this.context } ); @@ -26,10 +23,9 @@ export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - super.onInit(); + protected onInit(): Promise { getSP(this.context); + return super.onInit(); } protected onDispose(): void { @@ -45,16 +41,12 @@ export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart = { root: { height: 30 } }; export interface IAddJsCssReferenceProps { - description: string; context: WebPartContext; } diff --git a/samples/react-add-js-css-ref/src/webparts/addJsCssReference/components/IAddJsCssReferenceProps.ts b/samples/react-add-js-css-ref/src/webparts/addJsCssReference/components/IAddJsCssReferenceProps.ts deleted file mode 100644 index a4b5fd5fb..000000000 --- a/samples/react-add-js-css-ref/src/webparts/addJsCssReference/components/IAddJsCssReferenceProps.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { WebPartContext } from "@microsoft/sp-webpart-base"; - -export interface IAddJsCssReferenceProps { - description: string; - context:WebPartContext; -}