-
Notifications
You must be signed in to change notification settings - Fork 6
sp webpart base.basewebpart.onbeforeserialize
Home > @microsoft/sp-webpart-base > BaseWebPart > onBeforeSerialize
This event method is called before the web part is serialized. virtual
Signature:
protected onBeforeSerialize(): void;
Returns:
void
The default implementation is a no-op. The serialization process serializes the web part property bag i.e. this.properties. This API gives the web part a chance to update it's property bag before the serialization happens. Some web part's may keep their state other objects or even in the DOM. If a web part needs to persist some of that state, it needs to override this API and update the web part property bag to the latest state. If a web part updates the property bag with invalid property values, those will get persisted. So that should be avoided. The web part property bag should always contain valid property values.