pnp / sp-dev-fx-property-controls

Reusable SPFx property pane controls - Open source initiative
https://pnp.github.io/sp-dev-fx-property-controls/
MIT License
233 stars 151 forks source link

Can it work with SPFx 1.17.3 ? #573

Open Ofer-Gal opened 1 year ago

Ofer-Gal commented 1 year ago

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

<FilePicker buttonLabel={'Add Files'}
          includePageLibraries={false}  
          onSave={_onFilePickerSave}
          context={this.context} />

Observed Behavior

I get system error in the workbench saying :

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!!
 />

It works.

What could be the difference?

Thanks!

ghost commented 1 year ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.