Merge pull request #3460 from srpmtt/pnp-init-fix

fix pnp sp init
This commit is contained in:
Hugo Bernier 2023-02-03 22:47:11 -05:00 committed by GitHub
commit c21a343e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@
"This web part displays a sidebar that allows users to provide feedback on various sections of your site." "This web part displays a sidebar that allows users to provide feedback on various sections of your site."
], ],
"creationDateTime": "2022-09-14", "creationDateTime": "2022-09-14",
"updateDateTime": "2022-09-14", "updateDateTime": "2023-01-20",
"products": [ "products": [
"SharePoint" "SharePoint"
], ],

View File

@ -19,7 +19,7 @@
"@microsoft/sp-property-pane": "1.15.2", "@microsoft/sp-property-pane": "1.15.2",
"@microsoft/sp-webpart-base": "1.15.2", "@microsoft/sp-webpart-base": "1.15.2",
"@pnp/logging": "^3.6.0", "@pnp/logging": "^3.6.0",
"@pnp/sp": "^3.6.0", "@pnp/sp": "^3.11.0",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"office-ui-fabric-react": "7.185.7", "office-ui-fabric-react": "7.185.7",
"react": "16.13.1", "react": "16.13.1",

View File

@ -9,7 +9,7 @@ import "@pnp/sp/batching";
let _sp: SPFI = null; let _sp: SPFI = null;
export const getSP = (context?: WebPartContext): SPFI => { export const getSP = (context?: WebPartContext): SPFI => {
if (_sp === null && context !== null) { if (context != null) {
_sp = spfi().using(SPFx(context)).using(PnPLogging(LogLevel.Warning)); _sp = spfi().using(SPFx(context)).using(PnPLogging(LogLevel.Warning));
} }
return _sp; return _sp;