This call will sync the document state of every collaborator in the session to the same value.

// example use force every collaborators document to become the value of content
const content = 'this is the new content';

Nominally syncing isn't something you should have to think about when using Codox, however there are some scenarios where you may need to explicitly sync and this is where forceSync could be useful.

One scenario where you might need to use forceSync is if your content management backend supports a versioning system, and front-end users may 'revert' to previous versions from the user-interface. To ensure that other collaborators also revert to the same document version, you should invoke forceSync with the version's document state as the input. An example flow might look like this:

// example handling select document version
async function handleVersionSelected(versionId) {
// call version fetch api
const docState = await fetchDocumentVersion(versionId);
// synchronize document state