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/blogs/linh-nguyen/dates/2020/3/improve-ope-with-client-side-rendering/
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) {
.............
}
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"
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 ?