diff --git a/docs/documentation/docs/controls/LivePersona.md b/docs/documentation/docs/controls/LivePersona.md index ece99ac9a..85a7a685a 100644 --- a/docs/documentation/docs/controls/LivePersona.md +++ b/docs/documentation/docs/controls/LivePersona.md @@ -35,7 +35,7 @@ import { LivePersona } from "@pnp/spfx-controls-react/lib/LivePersona"; } - context={this.props.context} + serviceScope={this.context.serviceScope} /> ``` @@ -47,7 +47,7 @@ The `LivePersona` control can be configured with the following properties: | Property | Type | Required | Description | | ---- | ---- | ---- | ---- | -| context | BaseComponentContext | yes | The context object of the SPFx loaded webpart or customizer. | +| serviceScope | ServiceScope | yes | The SPFx ServiceScope object loaded from context of web part or extension. | | upn |string | yes | User UPN. | | disableHover | boolean | no | If info should not appear on hover. | -| template | string \| JSX.ELement | yes | The content to wrap with persona info. | +| template | string | JSX.ELement | yes | The content to wrap with persona info. | diff --git a/src/controls/LivePersona/ILivePersonaProps.ts b/src/controls/LivePersona/ILivePersonaProps.ts index 15ba0db1d..cd5f55025 100644 --- a/src/controls/LivePersona/ILivePersonaProps.ts +++ b/src/controls/LivePersona/ILivePersonaProps.ts @@ -1,13 +1,9 @@ -import { BaseComponentContext} from "@microsoft/sp-component-base"; import { ServiceScope } from "@microsoft/sp-core-library"; export interface ILivePersonatProps { - /** - * The Web Part context - */ - context?: BaseComponentContext; + /** - * The Web Part context + * The service locator pattern used by the SharePoint Framework. */ serviceScope: ServiceScope; /** diff --git a/src/controls/LivePersona/LivePersona.tsx b/src/controls/LivePersona/LivePersona.tsx index 913ada797..bc2924b28 100644 --- a/src/controls/LivePersona/LivePersona.tsx +++ b/src/controls/LivePersona/LivePersona.tsx @@ -13,7 +13,7 @@ export const LivePersona: React.FunctionComponent = ( ) => { const [isComponentLoaded, setIsComponentLoaded] = useState(false); const sharedLibrary = useRef(); - const { upn, template, disableHover, context, serviceScope } = props; + const { upn, template, disableHover, serviceScope } = props; useEffect(() => { (async () => { @@ -22,7 +22,7 @@ export const LivePersona: React.FunctionComponent = ( sharedLibrary.current = await SPComponentLoader.loadComponentById(LIVE_PERSONA_COMPONENT_ID); setIsComponentLoaded(true); } catch (error) { - Log.error(`[LivePersona]`, error, serviceScope ?? context.serviceScope); + Log.error(`[LivePersona]`, error, serviceScope ); } } })(); @@ -38,7 +38,7 @@ if (isComponentLoaded) { PersonaType: 'User' }, upn: upn, - serviceScope: serviceScope ?? context.serviceScope, + serviceScope: serviceScope, }, createElement("div",{},template)); } return renderPersona;