Reputation: 101
i have two client webparts in a page. both of them use pnpjs to retreive list items. the problem is that one webpart correctly loads sp.web while the other doesn't. both use the same code to instantiate the element.
this.sp = spfi().using(SPFx(this.props.context)); //props.context coming from webpart.ts
what i get in both is:
1 (working)
2 (not working)
can anyone solve the mistery? :) thanks everyone!
Upvotes: 2
Views: 2611
Reputation: 101
i found out that if i import spfi and SPFx from '@pnp/sp/presets/all' instead of "@pnp/sp" it then works. i'm not that good to know exactly the reason but it now works, if this can help anyone! :)
Upvotes: 5