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

sp component base.icomponentpropertymetadata.shouldnotpersist

John Nguyen edited this page Aug 19, 2021 · 1 revision

Home > @microsoft/sp-component-base > IComponentPropertyMetadata > shouldNotPersist

IComponentPropertyMetadata.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 component and optimize the component 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 component 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