OlivierCC/sp-client-custom-fields

Doesn't work with latest SPFx build / latest yeoman generator scaffold?

WayneJSawyer opened this issue · 7 comments

Hi,

Just trying out the SPFx Client Custom Fields for the first time. Love the look of them!

Sadly I can't get them to work with my SPFx web part created by the yo @microsoft/sharepoint scaffold. Are there plans to update these to the latest builds of sp-webpart-base etc. any time soon?

Cheers,
Wayne

Hi @WayneJSawyer, I will check it very soon, if there are problems with last SPFx build, I will published a fix asap. Thanks for your feedbacks and stay tuned here.
Regards,
Olivier

Hi @WayneJSawyer,

The new version 1.3.5 is now working with latest SPFx version (packages 1.1.1) and is now available on github and npm.

Regards,

Olivier

I am getting below error after updating to 1.3.4 version.

[17:04:12] Error - typescript - node_modules\sp-client-custom-fields\node_modules@microsoft\sp-http\lib\httpClient\Http
ClientResponse.d.ts(14,21): error TS2420: Class 'HttpClientResponse' incorrectly implements interface 'Response'.
[17:04:12] Error - typescript - node_modules\sp-client-custom-fields\node_modules@microsoft\sp-http\lib\httpClient\Http
ClientResponse.d.ts(25,19): error TS2304: Cannot find name 'ReadableStream'.
[17:04:12] Error - typescript - \MyWebPart.ts(261,51): error TS2345: Argu
ment of type '{ label: string; query: string; includeHidden: false; orderBy: PropertyFieldSPListQueryOrderBy.Ti...' is n
ot assignable to parameter of type 'IPropertyFieldSPListQueryProps'.

Solution was working fine with 1.3.3 with SPfx.

Hi @Parth2402patel,

The call signature for the custom fields has changed with the version 1.3.5, you need to add more parameters:

render: this.render.bind(this),
disableReactivePropertyChanges: this.disableReactivePropertyChanges

You can see an example here: https://oliviercc.github.io/sp-client-custom-fields/propertyfieldsplistquery

For the error about sp-http, it's probably because you need to update your package version in your pacakge.json file, as:

"@microsoft/sp-http": "^1.1.1"

See the lib package.json file if you need a sample: https://github.com/OlivierCC/sp-client-custom-fields/blob/master/package.json

After changing your package.json, you need to remove your node_modules folder (rd /s /q node_modules) and reinstall it (npm install)

Hi @OlivierCC ,

Thank you for your quick response, have executed both steps as per your recommendation. Unfortunately still have the below errors. I have crossed check every dependencies still facing issue during gulp serve.

Current library version
@microsoft/sp-http": "^1.1.1
"sp-client-custom-fields": "^1.3.5"

Also configuration of 'PropertyFieldSPListQueryOrderBy' field type

PropertyFieldSPListQuery('queryPrimery', {
label: 'Select a query',
query: this.properties.queryPrimery,
includeHidden: false,
//baseTemplate: 109,
orderBy: PropertyFieldSPListQueryOrderBy.Title,
showOrderBy: true,
showMax: true,
showFilters: true,
max: 50,
disabled: false,
onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
render: this.render.bind(this),
disableReactivePropertyChanges: this.disableReactivePropertyChanges,
properties: this.properties,
context: this.context,
onGetErrorMessage: null,
deferredValidationTime: 0,
key: 'dataSourceOneQueryField'
})

Find below error details.

Error - typescript - node_modules@microsoft\sp-http\lib\httpClient\HttpClientResponse.d.ts(14,21): error TS2420: Clas
'HttpClientResponse' incorrectly implements interface 'Response'.
Error - typescript - node_modules@microsoft\sp-http\lib\httpClient\HttpClientResponse.d.ts(25,19): error TS2304: Cann
find name 'ReadableStream'.
Error - typescript - node_modules\sp-client-custom-fields\node_modules@microsoft\sp-http\lib\httpClient\HttpClientRes
nse.d.ts(14,21): error TS2420: Class 'HttpClientResponse' incorrectly implements interface 'Response'.
Error - typescript - node_modules\sp-client-custom-fields\node_modules@microsoft\sp-http\lib\httpClient\HttpClientRes
nse.d.ts(25,19): error TS2304: Cannot find name 'ReadableStream'.
Error - typescript - MyWebpart.ts(104,178): error TS2345: Argument o
type 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'.
Error - typescript - MyWebpart.ts(129,258): error TS2345: Argument o
type 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'.
Error - typescript - MyWebpart.ts(82,215): error TS2345: Argument of t
e 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'.
Error - typescript - MyWebpart.ts(91,209): error TS2345: Argument of t
e 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'.
Error - typescript - MyWebpartts(261,51): error TS2345: Argument of t
e '{ label: string; query: string; includeHidden: false; orderBy: PropertyFieldSPListQueryOrderBy.Ti...' is not assignle to parameter of type 'IPropertyFieldSPListQueryProps'.

Please let me know, if i am missing something.

Regards,
Parth

Hi @OlivierCC,

I have downgraded to V 1.3.4 and everything is working. Anything missing with 1.3.5 version ?

Regards,
Parth

yes, I am facing the same error. It was resolved when we downgraded to v1.3.4