ERROR:
Cannot read properties of undefined (reading 'web')
CALL STACK:
TypeError: Cannot read properties of undefined (reading 'web')
at new FileBrowserService (https://localhost:4321/dist/sp-fx-1173-vanilla-web-part.js:120315:71)
at new FilePicker (https://localhost:4321/dist/sp-fx-1173-vanilla-web-part.js:114395:36)
at gr (https://res-1.cdn.office.net/files/sp-client/sp-webpart-workbench-assembly_en-us_7a90437cb2e1321248b0dd6c186e382e.js:69:55058)
at Go (https://res-1.cdn.office.net/files/sp-client/sp-webpart-workbench-assembly_en-us_7a90437cb2e1321248b0dd6c186e382e.js:69:74405)
at Ks (https://res-1.cdn.office.net/files/sp-client/sp-webpart-workbench-assembly_en-us_7a90437cb2e1321248b0dd6c186e382e.js:69:117705)
at wc (https://res-1.cdn.office.net/files/sp-client/sp-webpart-workbench-assembly_en-us_7a90437cb2e1321248b0dd6c186e382e.js:69:103931)
at Cc (https://res-1.cdn.office.net/files/sp-client/sp-webpart-workbench-assembly_en-us_7a90437cb2e1321248b0dd6c186e382e.js:69:103859)
at xc (https://res-1.cdn.office.net/files/sp-client/sp-webpart-workbench-assembly_en-us_7a90437cb2e1321248b0dd6c186e382e.js:69:103722)
at hc (https://res-1.cdn.office.net/files/sp-client/sp-webpart-workbench-assembly_en-us_7a90437cb2e1321248b0dd6c186e382e.js:69:100709)
at uc (https://res-1.cdn.office.net/files/sp-client/sp-webpart-workbench-assembly_en-us_7a90437cb2e1321248b0dd6c186e382e.js:69:98065)
However, when I change the out of the box class to a functional component and change the code to:
<FilePicker buttonLabel={'Add Files'}
includePageLibraries={false} //hideLinkUploadTab // hideOrganisationalAssetTab hideRecentTab hideStockImages hideLocalUploadTab
onSave={_onFilePickerSave}
context ={context as never} //Notice the casting!!
/>
Category
Version
Please specify what version of the library you are using: [ 3.14.0 ]
Expected / Desired Behavior / Question
See a button for this code
Observed Behavior
I get system error in the workbench saying :
However, when I change the out of the box class to a functional component and change the code to:
It works.
What could be the difference?
Thanks!