Comments (21)
I created a new fix (to fix the fix): #1736
from sp-dev-fx-controls-react.
A new version has been released which includes this fix.
Can you check and tell me if that's ok for you?
Hi @michaelmaillot. It's works for me.
from sp-dev-fx-controls-react.
@joelfmrodrigues Why did you close the bug without comment when there is an open pull request to fix existing issues?
Hi @IRRDC this issue has been closed because its original PR (which was a rollback from has been released in 3.16.1) has been merged and closed, then released in minor version.
Your PR is linked to a global behavior for which we didn't figure out the root cause, thus not linked to this issue in particular.
Before addressing this one, we need to understand what causes this results
sub-array to appear unconsistently, not only providing a solution that can handle both scenarios. We'll keep your PR open meanwhile of course.
I'll open a new issue.
from sp-dev-fx-controls-react.
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
from sp-dev-fx-controls-react.
Hi @bva999,
I tried to repro without success but maybe I'm missing context info.
Can you give me details about the Taxonomy field you're refering to, such as column settings, term structure (parent / children),...?
In my case I tried with following config (sorry it's in french):
Edit: this is the content of my defaultValue
from sp-dev-fx-controls-react.
Hi @michaelmaillot .
Here is my field object from debugger:
`{
"@odata.editLink": "Web/Lists(guid'***')/Fields(guid'***')",
"@odata.id": "https://***/_api/Web/Lists(guid'***')/Fields(guid'***')",
"@odata.type": "#SP.Taxonomy.TaxonomyField",
"AllowMultipleValues": true,
"AnchorId": "00000000-0000-0000-0000-000000000000",
"AutoIndexed": false,
"CanBeDeleted": true,
"ClientSideComponentId": "00000000-0000-0000-0000-000000000000",
"ClientSideComponentProperties": null,
"ClientValidationFormula": null,
"ClientValidationMessage": null,
"CreateValuesInEditForm": false,
"CustomFormatter": null,
"DefaultFormula": null,
"DefaultValue": "",
"DependentLookupInternalNames": [
],
"Description": "",
"Direction": "none",
"EnforceUniqueValues": false,
"EntityPropertyName": "Sectors",
"FieldTypeKind": 0,
"Filterable": true,
"FromBaseType": false,
"Group": "PMCG",
"Hidden": false,
"Id": "f848fa73-04f7-44bb-95f2-1fb32df1211c",
"Indexed": false,
"IndexStatus": 0,
"InternalName": "Sectors",
"IsAnchorValid": true,
"IsDependentLookup": false,
"IsDocTagsEnabled": false,
"IsEnhancedImageTaggingEnabled": false,
"IsKeyword": false,
"IsModern": false,
"IsPathRendered": true,
"IsRelationship": true,
"IsTermSetValid": true,
"JSLink": "SP.UI.Taxonomy.js|SP.UI.Rte.js(d)|SP.Taxonomy.js(d)|ScriptForWebTaggingUI.js(d)",
"LookupField": "Path$Resources:core,Language;",
"LookupList": "{02461283-ca3f-417b-bbc7-9bedce50e969}",
"LookupWebId": "5bd3f994-09e3-4405-9d01-36fb23af4515",
"Open": false,
"order": 6,
"PinnedToFiltersPane": false,
"PrimaryFieldId": null,
"ReadOnlyField": false,
"RelationshipDeleteBehavior": 0,
"Required": false,
"SchemaXml": "<Field Type=\"TaxonomyFieldTypeMulti\" DisplayName=\"Sectors\" List=\"{02461283-ca3f-417b-bbc7-9bedce50e969}\" WebId=\"5bd3f994-09e3-4405-9d01-36fb23af4515\" ShowField=\"Path1033\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Mult=\"TRUE\" Sortable=\"FALSE\" Group=\"PMCG\" ID=\"{f848fa73-04f7-44bb-95f2-1fb32df1211c}\" SourceID=\"{5bd3f994-09e3-4405-9d01-36fb23af4515}\" StaticName=\"Sectors\" Name=\"Sectors\" AllowDeletion=\"TRUE\" Version=\"48\" ColName=\"int2\" RowOrdinal=\"0\"><Default /><Customization><ArrayOfProperty><Property><Name>SspId</Name><Value xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q1:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">5e76d934-89d8-476d-a29f-379cd1d37584</Value></Property><Property><Name>GroupId</Name></Property><Property><Name>TermSetId</Name><Value xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q2:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">c6c7e0c1-3e32-4f8f-9c31-d4b6b0582a9e</Value></Property><Property><Name>AnchorId</Name><Value xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q3:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">00000000-0000-0000-0000-000000000000</Value></Property><Property><Name>UserCreated</Name><Value xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q4:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">false</Value></Property><Property><Name>Open</Name><Value xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q5:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">false</Value></Property><Property><Name>TextField</Name><Value xmlns:q6=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q6:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">{46f582c6-b2a5-4035-9ae6-dff9e4ab8ee2}</Value></Property><Property><Name>IsPathRendered</Name><Value xmlns:q7=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q7:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">true</Value></Property><Property><Name>IsKeyword</Name><Value xmlns:q8=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q8:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">false</Value></Property><Property><Name>TargetTemplate</Name></Property><Property><Name>CreateValuesInEditForm</Name><Value xmlns:q9=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q9:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">false</Value></Property><Property><Name>FilterAssemblyStrongName</Name><Value xmlns:q10=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q10:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">Microsoft.SharePoint.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Value></Property><Property><Name>FilterClassName</Name><Value xmlns:q11=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q11:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">Microsoft.SharePoint.Taxonomy.TaxonomyField</Value></Property><Property><Name>FilterMethodName</Name><Value xmlns:q12=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q12:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">GetFilteringHtml</Value></Property><Property><Name>FilterJavascriptProperty</Name><Value xmlns:q13=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q13:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">FilteringJavascript</Value></Property></ArrayOfProperty></Customization></Field>",
"Scope": "/sites/development/Lists/Partners",
"Sealed": false,
"ShowInFiltersPane": 0,
"Sortable": false,
"SspId": "5e76d934-89d8-476d-a29f-379cd1d37584",
"StaticName": "Sectors",
"TargetTemplate": null,
"TermSetId": "c6c7e0c1-3e32-4f8f-9c31-d4b6b0582a9e",
"TextField": "46f582c6-b2a5-4035-9ae6-dff9e4ab8ee2",
"Title": "Sectors",
"TypeAsString": "TaxonomyFieldTypeMulti",
"TypeDisplayName": "Managed Metadata",
"TypeShortDescription": "Managed Metadata",
"UnlimitedLengthInDocumentLibrary": false,
"UserCreated": false,
"ValidationFormula": null,
"ValidationMessage": null
}`
{
"@odata.editLink": "Web/Lists(guid'***')/Fields(guid'***')",
"@odata.id": "https://***/_api/Web/Lists(guid'***')/Fields(guid'***')",
"@odata.type": "#SP.Taxonomy.TaxonomyField",
"AllowMultipleValues": true,
"AnchorId": "00000000-0000-0000-0000-000000000000",
"AutoIndexed": false,
"CanBeDeleted": true,
"ClientSideComponentId": "00000000-0000-0000-0000-000000000000",
"ClientSideComponentProperties": null,
"ClientValidationFormula": null,
"ClientValidationMessage": null,
"CreateValuesInEditForm": false,
"CustomFormatter": null,
"DefaultFormula": null,
"DefaultValue": "",
"DependentLookupInternalNames": [
],
"Description": "",
"Direction": "none",
"EnforceUniqueValues": false,
"EntityPropertyName": "Sectors",
"FieldTypeKind": 0,
"Filterable": true,
"FromBaseType": false,
"Group": "PMCG",
"Hidden": false,
"Id": "f848fa73-04f7-44bb-95f2-1fb32df1211c",
"Indexed": false,
"IndexStatus": 0,
"InternalName": "Sectors",
"IsAnchorValid": true,
"IsDependentLookup": false,
"IsDocTagsEnabled": false,
"IsEnhancedImageTaggingEnabled": false,
"IsKeyword": false,
"IsModern": false,
"IsPathRendered": true,
"IsRelationship": true,
"IsTermSetValid": true,
"JSLink": "SP.UI.Taxonomy.js|SP.UI.Rte.js(d)|SP.Taxonomy.js(d)|ScriptForWebTaggingUI.js(d)",
"LookupField": "Path$Resources:core,Language;",
"LookupList": "{02461283-ca3f-417b-bbc7-9bedce50e969}",
"LookupWebId": "5bd3f994-09e3-4405-9d01-36fb23af4515",
"Open": false,
"order": 6,
"PinnedToFiltersPane": false,
"PrimaryFieldId": null,
"ReadOnlyField": false,
"RelationshipDeleteBehavior": 0,
"Required": false,
"SchemaXml": "<Field Type=\"TaxonomyFieldTypeMulti\" DisplayName=\"Sectors\" List=\"{02461283-ca3f-417b-bbc7-9bedce50e969}\" WebId=\"5bd3f994-09e3-4405-9d01-36fb23af4515\" ShowField=\"Path1033\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Mult=\"TRUE\" Sortable=\"FALSE\" Group=\"PMCG\" ID=\"{f848fa73-04f7-44bb-95f2-1fb32df1211c}\" SourceID=\"{5bd3f994-09e3-4405-9d01-36fb23af4515}\" StaticName=\"Sectors\" Name=\"Sectors\" AllowDeletion=\"TRUE\" Version=\"48\" ColName=\"int2\" RowOrdinal=\"0\"><Default /><Customization><ArrayOfProperty><Property><Name>SspId</Name><Value xmlns:q1=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q1:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">5e76d934-89d8-476d-a29f-379cd1d37584</Value></Property><Property><Name>GroupId</Name></Property><Property><Name>TermSetId</Name><Value xmlns:q2=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q2:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">c6c7e0c1-3e32-4f8f-9c31-d4b6b0582a9e</Value></Property><Property><Name>AnchorId</Name><Value xmlns:q3=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q3:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">00000000-0000-0000-0000-000000000000</Value></Property><Property><Name>UserCreated</Name><Value xmlns:q4=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q4:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">false</Value></Property><Property><Name>Open</Name><Value xmlns:q5=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q5:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">false</Value></Property><Property><Name>TextField</Name><Value xmlns:q6=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q6:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">{46f582c6-b2a5-4035-9ae6-dff9e4ab8ee2}</Value></Property><Property><Name>IsPathRendered</Name><Value xmlns:q7=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q7:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">true</Value></Property><Property><Name>IsKeyword</Name><Value xmlns:q8=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q8:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">false</Value></Property><Property><Name>TargetTemplate</Name></Property><Property><Name>CreateValuesInEditForm</Name><Value xmlns:q9=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q9:boolean\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">false</Value></Property><Property><Name>FilterAssemblyStrongName</Name><Value xmlns:q10=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q10:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">Microsoft.SharePoint.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Value></Property><Property><Name>FilterClassName</Name><Value xmlns:q11=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q11:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">Microsoft.SharePoint.Taxonomy.TaxonomyField</Value></Property><Property><Name>FilterMethodName</Name><Value xmlns:q12=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q12:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">GetFilteringHtml</Value></Property><Property><Name>FilterJavascriptProperty</Name><Value xmlns:q13=\"http://www.w3.org/2001/XMLSchema\" p4:type=\"q13:string\" xmlns:p4=\"http://www.w3.org/2001/XMLSchema-instance\">FilteringJavascript</Value></Property></ArrayOfProperty></Customization></Field>",
"Scope": "/sites/development/Lists/Partners",
"Sealed": false,
"ShowInFiltersPane": 0,
"Sortable": false,
"SspId": "5e76d934-89d8-476d-a29f-379cd1d37584",
"StaticName": "Sectors",
"TargetTemplate": null,
"TermSetId": "c6c7e0c1-3e32-4f8f-9c31-d4b6b0582a9e",
"TextField": "46f582c6-b2a5-4035-9ae6-dff9e4ab8ee2",
"Title": "Sectors",
"TypeAsString": "TaxonomyFieldTypeMulti",
"TypeDisplayName": "Managed Metadata",
"TypeShortDescription": "Managed Metadata",
"UnlimitedLengthInDocumentLibrary": false,
"UserCreated": false,
"ValidationFormula": null,
"ValidationMessage": null
}`
Terms Structure:
from sp-dev-fx-controls-react.
Ok I can repro the issue.
If I'm not mistaken, we shouldn't end up in the last else block (in the screen) as this one is reached for a new item. We should be inside the first if block that parses the Taxonomy array values. And neither you and me have a property called "results" in the defaultValue
.
@IRRDC following what you've stated here, I would like to get more info regarding your use case (list / library, field properties, site context,...), if you don't mind.
I want to understand what are we missing here, even if I realized that I didn't push far enough tests when merging the PR #1718...
from sp-dev-fx-controls-react.
@michaelmaillot Thanks for looking into this. I had to search for a while and noticed that back in August I got my information from my web part stopping on the error in the compiled code.
Here is the screenshot from back then:
While I'm directly debugging in the checked out TypeScript code where the data seems not to be split into __metadata and results:
So I guess a better check to see if item and item[field.InternalName] exist should have been enough.
from sp-dev-fx-controls-react.
A new version has been released which includes this fix.
Can you check and tell me if that's ok for you?
from sp-dev-fx-controls-react.
@michaelmaillot I have mixed results. In my existing web part solution I'm back to my original problem, where in the compiled code item[field.InternalName] contains a sub-property "results" which has to be iterated. My original fix worked for that in the compiled code from the npm package.
I have created a new web part and just added the dynamic form with references to the same list and in that one the returned data structure is different and as expected.
I have not been able to figure out the reason for this. Maybe doing manual calls to @pnp/sp in some parts of the code leads to the inclusion of @pnp/sp 3.22.0 in the compiled package and incompatibilities with 2.5.0 required by controls-react. I'll try to test that next. At the moment I can see both versions of @pnp/sp in separate folders of node_modules in my solution.
from sp-dev-fx-controls-react.
Thanks for this feedback. This is strange indeed and I couldn't reproduce the .results
thing you're facing.
Are you suggesting that @pnp/sp 3.x returns data in a different format than 2.x version?
from sp-dev-fx-controls-react.
That's what I thought first but I haven't been able to reproduce the error in the newly created web part and have by now copied nearly all the code and all the settings from the one that throws the error (and produces the additional "results" property).
from sp-dev-fx-controls-react.
@IRRDC did you figure out the results
origin?
from sp-dev-fx-controls-react.
No, it's very frustrating. I've spent days on it and created new working solutions and then suddenly the dynamic form failed to load again because the data was in "results" again. I thought I had a issue free version a few hours ago but it fails when testing on a different SharePoint tenent. I will create a new solution again tomorrow and see if it fails from the start on that tenent.
from sp-dev-fx-controls-react.
I started again with a new solution and a HelloWorld web part with just the dynamic form and it can display list A from site X on tenant 1 and list B on site Y on tenant 1 and list C on tenant 2.
Yesterday's solutions that started the same way and got the code of our actual web parts added to them can display a sub set of those three test lists. Some can display none of the three, some can only display list A, etc. It is consistent which solution can display which list. When it doesn't work it's because "results" got added to the data.
The only explanation I can come up with is that different versions of the very long list of packages don't get resolved perfectly when the code gets comiled into a single js file. I had a similar problem about a year ago when it was very important in which order I installed the spfx-controls-react and spfx-property-controls because they used different versions of pnp/sp and even though those different versions ended up in their node_modules folders one of them used not their own version but the one from the base folder. That caused errors during compilation which where much easier to spot.
Can we add a fallback for this weird case, like:
if (item[field.internalname].hasownproperty('results')) { item[field.internalname] = item[field.internalname]['results']; }
?
from sp-dev-fx-controls-react.
I created another fix and copied the compiled code into my solution where it is now able to load the form for all sites and lists. #1744
from sp-dev-fx-controls-react.
Any thoughts?
from sp-dev-fx-controls-react.
@joelfmrodrigues Why did you close the bug without comment when there is an open pull request to fix existing issues?
from sp-dev-fx-controls-react.
@IRRDC thanks for the heads up, I may have mistaken this with another issue from a different PR from @michaelmaillot
Please give us a moment to check and I will reopen it if required.
from sp-dev-fx-controls-react.
During a quick test this morning I couldn't reproduce the issue with the new version but I could not perform all test scenarios due to this new issue in the dynamic form #1758
from sp-dev-fx-controls-react.
Done #1759
from sp-dev-fx-controls-react.
Related Issues (20)
- Issue with PeopleSearchService and @pnp/spfx-controls-react/lib/PeoplePicker HOT 3
- RichText write words backwards HOT 1
- How to properly use the adaptive card designer control in spfx 1.16.1 HOT 1
- Dynamic Form - Lookup field limited to first 100 items HOT 2
- Pass Custom Element into Adaptive Card Designer Host
- iFrame Dialog and Panel Cross Domain and Sandbox questions HOT 1
- iFrame Panel Control causes page to scroll when it is closed
- iFrameDialog Control causes page to scroll to top automatically when dialog was closed HOT 1
- FileTypeIcon Errors Out and Crashes Page HOT 2
- FilePicker - OneDrive items sort by Modified HOT 1
- `UploadFiles`: Add Property limit the number of files that a user can upload
- Enhancement : ListItemComments Ability to Like/Unlike and to reply on comments HOT 1
- Dynamic Form - Saving not working HOT 1
- TypeError: Cannot read properties of undefined (reading 'select') HOT 1
- Error - Upgrading to SPFx 1.19.0 HOT 9
- ModernTaxonomyPicker - allowMultipleSelections = false, but panel allows multiple items to be selected HOT 1
- SPFX List View CommandSet not appearing on list with the new lists UI HOT 1
- Grid layout settings as parameters
- PeoplePicker Group could not be found. HOT 1
- FilePicker JSX element class does not support attributes because it does not have a 'props' property HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sp-dev-fx-controls-react.