- 🇪🇪Estonia minff
I can confirm that this issue persists and effectively renders webforms used in view mode page not usable if they require any Ajax (such as adding another element). The Ajax URL in the JSON code points to the main view mode and therefore results in a JS error.
Setup in my case: the content type has several view modes activated, with the default view mode not having any webforms (node/1), while other view modes rendering webforms (node/1/application, for example). Webforms function normally outside of the view mode but since the Ajax call points to the default view mode (node/1) when making the call, it results in an error.
The issue indeed comes from the \Drupal\Core\Render\Element\RenderElement::preRenderAjaxForm() returning the default view mode URL, as pointed out by the previous commenter. Haven't found any non-dirty fixes thus far.
- 🇦🇺Australia nigelcunningham Geelong
I think I've just come across another variation of this issue in the bug I reported (exposed filter in a layout on a view mode page). I also traced the issue to the path returning the canonical URL for the parent path. I'm still investigating but I am currently wondering whether the right behaviour would be to define a route for each view mode page.
- 🇦🇺Australia nigelcunningham Geelong
In my case, the issue was that the module makes the parameters for the subrequest be entity type, entity id and view mode. This prevents the Context code from recognising the contexts it would have found in the original request (in my case a group), so the content doesn't display because the views parameters that get their contextual arguments from the request context aren't satisfied.
I have a module that seeks to set the group context in situations where the context might not be obvious. I had it disabled because I was wondering whether I really needed the code. It makes things work again.
All of this leads me to the conclusion that view_mode_page needs a fundamental change to work properly - I think it should perhaps provide dynamic routes that directly invoke the entity view controller. Unfortunately I don't have the time at the moment to make a patch that does that.