Component lifecycle

The component lifecycle includes creation, initializaiton, incremental updates, finalization and removal.

A component is created either during the Client-Side Framework (CSF) initialization stage, when the CSF finds elements that has the data-g-id attribute or during an incremental update, when the CSF detects a new data-g-id element in the incremental update chunk.

The <component>.initialize() is called when the component is ready to use, meaning that its component element is properly attached to the document (DOM) and, in the case of an incremental update, the documents have been completely updated by the engine.

A component is removed from the CSF when the data-g-id is removed, either explicitly (the data-g-id is evaluated to null) or when the engine removes a part of the document that contains elements with a data-g-id. The <component>.finalize() function is called before the component is removed.