Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

sp webpart base.iwebpartpropertymetadata.shouldnotpersist

John Nguyen edited this page Apr 22, 2021 · 2 revisions

Home > @microsoft/sp-webpart-base > IWebPartPropertyMetadata > shouldNotPersist

IWebPartPropertyMetadata.shouldNotPersist property

Indicates if the framework should persist the property on the server.

Signature:

shouldNotPersist?: boolean;

Remarks

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.

Clone this wiki locally