this.properties not initialized with default values (SPFX Client Webpart)

%3CLINGO-SUB%20id%3D%22lingo-sub-179226%22%20slang%3D%22en-US%22%3Ethis.properties%20not%20initialized%20with%20default%20values%20(SPFX%20Client%20Webpart)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-179226%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'm%20developing%20a%20SPFX%20Modern%20Site%20Client%20webpart%20that%20has%20a%20large%20number%20of%20properties%20(currently%20around%2040%20and%20growing).%3CBR%20%2F%3EDue%20to%20that%2C%20Ive%20moved%20the%20non-critical%20properties%20to%20a%20form%20on%20the%20webpart%20itself%20when%20in%20Edit%20Mode.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20issue%20I'm%20having%20is%20that%20all%20properties%20in%20%22this.properties%22%20are%20null%20on%20a%20new%20Webpart%2C%20essentially%20not%20using%20the%20defaults.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EI'm%20defining%20all%20defaults%20on%20Webpart.manifest.json%3CBR%20%2F%3E%3CBR%20%2F%3EAny%20ideia%20why%20the%20object%20is%20not%20initialized%20with%20the%20defaults%3F%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-179226%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1045826%22%20slang%3D%22en-US%22%3ERe%3A%20this.properties%20not%20initialized%20with%20default%20values%20(SPFX%20Client%20Webpart)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1045826%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F103284%22%20target%3D%22_blank%22%3E%40Ricardo%20-Ralm-%3C%2FA%3E%26nbsp%3BHave%20you%20considered%20adding%20these%20webpart%20properties%20into%20pages.%20I%20can%20link%20here%20a%20nice%20blog%20that%20shows%20how%20to%20group%20the%20properties%20and%20show%20them%20in%20pages%20within%20the%20property%20pane.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.c-sharpcorner.com%2Farticle%2Fspfx-property-pane-configuration-options%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.c-sharpcorner.com%2Farticle%2Fspfx-property-pane-configuration-options%2F%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi all,

 

I'm developing a SPFX Modern Site Client webpart that has a large number of properties (currently around 40 and growing).
Due to that, Ive moved the non-critical properties to a form on the webpart itself when in Edit Mode. 

 

The issue I'm having is that all properties in "this.properties" are null on a new Webpart, essentially not using the defaults. 


I'm defining all defaults on Webpart.manifest.json

Any ideia why the object is not initialized with the defaults? 

 

Thanks. 

 

1 Reply
Highlighted

@Ricardo -Ralm- Have you considered adding these webpart properties into pages. I can link here a nice blog that shows how to group the properties and show them in pages within the property pane.

https://www.c-sharpcorner.com/article/spfx-property-pane-configuration-options/