Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

How to show the drafted changes real-time on a project built with React components

Vote:
 

I have a project that uses Optimizely CMS 12.32.x. The project uses React server components for parts of the frontend.

One drawback of this implementation is that the pages in the preview mode is not rendering the content with drafted changes instantly after making the changes. Suppose, I have a block with a text field. When visiting the block in the preview mode, if I update the text field, the preview mode does not reflect the changes. I need to either publish the block or reload the page to see the draft. I understand this is how the server components work.

I was trying to find ways to re-render the React component once the changes have been "Autosaved" as a draft. I was hoping to subscribe to the event that fires inside the Dojo when the draft is saved. I tried the events listed in this blog - https://gregwiechec.com/2015/08/using-dojo-topic-publish-and-topic-subscribe/. However, I did not find the event I needed. I am also unsure what would be the ideal way to re-render the react components.

Can anyone tell me if this is the right approach? Are there any easier alternatives? Thank you.

#337182
Mar 12, 2025 17:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.