2

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)

enter image description here

2 (not working)

enter image description here

can anyone solve the mistery? :) thanks everyone!

1 Answers1

4

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! :)