-
Notifications
You must be signed in to change notification settings - Fork 5
sp webpart base.iwebpartpropertymetadata.shouldnotpersist
Home > @microsoft/sp-webpart-base > IWebPartPropertyMetadata > shouldNotPersist
Indicates if the framework should persist the property on the server.
Signature:
shouldNotPersist?: boolean;
Use this for properties that are only important in run-time, and do not need to persist on the server. This can reduce the size of the serialized data of the web part and optimize the web part load time. The property value will be removed from the serialized data sent to the server, but this has no effect on the run-time property bag. The property value will still be available in the onBeforeSerialize()
method, and the value will not be cleared from the run-time property bag. The initial render of your web part should not depend on the value of the property. Setting a default value for the property can be done in onInit()
method.
Note that if the property path refers to a property that has a complex object as the value, the whole object will be removed from the persisted data.