Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

How to know if async block is rendered in edit mode

ZZ
ZZ
Vote:
 

We have a landing page after login where different blocks are rendered async (call from the browser) 

All the blocks communicate with our internal API. I have created stub data for all the API endpoints. The problem I am facing is that PageEditing.PageIsInEditMode is true for the page but returns false for every embedded block except Block A which is not rendered async via user browser

The blocks are rendered async via JavaScript called from the landing page -> FetchAsynBlock?blockId=10

Due to this error the page is not rendering in view mode.

What can be dont to overcome this issue ? 

#259631
Edited, Jul 29, 2021 12:18
Vote:
 

I am not 100% I understand your issue but since you are effectively client side rendering there are some properities like epi.InEditMode which might help. See the links below for some more information:

https://world.optimizely.com/documentation/developer-guides/CMS/editing/on-page-editing-with-client-side-rendering/ 

https://world.optimizely.com/blogs/linh-nguyen/dates/2020/3/improve-ope-with-client-side-rendering/ 

#260213
Aug 06, 2021 15:39
ZZ
Vote:
 

Thanks for your reply.

The issue is that I am loading page and then loading content (blocks) later via JQuery callback, which delivers markup back to the page.

On loading content via JQuery PageIsInEditMode returns false

This is the script that runs on user browser 

$('#asyncBlock@(Model.BlockProperty)')
                .load('@Response.ApplyAppPathModifier(string.Format("/FetchAsynBlock?blockId={0}", Model.BlockProperty))',
                    function (respText, statusText, xhr) {
                 .............
               }
#260335
Edited, Aug 09, 2021 8:33
Vote:
 

You may be able to the epi object as described here: https://world.optimizely.com/documentation/developer-guides/CMS/editing/on-page-editing-with-client-side-rendering/ look for "Handling context modes"

#260337
Aug 09, 2021 9:31
* 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.