Base synchronization ensures the locally hosted copy of a base used by a deployed experience matches the cloud-hosted master version of that base. This synchronization process occurs in one of two ways:
- Automatic base synchronization when an experience is first run. This sync process is unavoidable.
- Requested synchronizations, occurring periodically, initiated in response to a trigger event. This sync process occurs at moments determined by the Composer user.
Whenever these occur, displaying content informing the user that they need to wait for an update to complete is a good practice. This is accomplished using the Sync triggers and actions available with every instance of a Headless CMS Interface Asset.
Experience launch: Waiting for synchronization to complete
Synchronization between the local copy of a base and its cloud-hosted master always occurs when an experience first launches. This synchronization can take a while, so we recommend implementing a "loading screen" using a dedicated scene or an experience layer to display a message until the sync process completes.
In this example, we've created a "Sync scene" displayed whenever H-CMS base loading/synchronization occurs.
The "Sync scene" is the first scene displayed when the experience runs. Associated with this scene is a "Has been entered" trigger, which calls the "Sync local base" action. Even though the initial synchronization occurs automatically, we add this action so the scene can be used at later times during the experience run.
To explicitly warn the user that experience content is being loaded, the "Sync scene" should contain some message/animation informing the user that content is loading. This information can be displayed right away, or its appearance could be caused by the "Sync started" trigger.
Use the "Sync completed" trigger to identify when the sync process has been completed, and then navigate to the first content scene using the "Go to scene" action. You may also want to consider adding an alternative trigger/action pair for the "Sync failed" trigger in case of a synchronization problem.
Other than after the initial launch of an experience, base synchronization will not occur automatically. What you can do is identify moments when synchronization can safely occur - such as when the experience times out due to lack of interaction - and use that moment to send the experience to the "Sync scene", causing another synchronization.
More information about triggered synchronization is available in this article.
Video Explanation - Synchronize the local H-CMS base
You will find in the Quarterly Q&A Live - Summer Edition 2023 video, a detailed example of how to ensure the synchronization of the local Headless CMS base before permitting experience interaction.