- Issue created by @fskreuz
When render cache debugging β is enabled (services.yml, parameters > render.config > debug: true), the output will contain render cache debugging comments. This prevents the parsing of the response, especially if the return type is JSON.
The render cache debugging comments don't seem to appear if the response is a JsonResponse
straight from a controller. I have not looked into where rest_views
and a straight up controller returning JsonResponse
differ. I also could not find where or how to selectively disable render cache debugging when on a rest_views
route.
While render cache debugging is never enabled on deployed code (i.e. this never actually happens on production), it's inconvenient during development where all debugging options are turned on.
1. Enable
render cache debugging β
and rebuild cache.
2. Render a textbox with an autocomplete (e.g. render a block on the page with a textfield
render element that has the #autocomplete_route_name
property whose value is a route name).
3. Create a controller on a route, have it return a JsonResponse of an array whose items are arrays containing a label
and value
property.
4. Create a rest_views
display returning the same thing as Step 2.
5. Use the route of the controller in Step 3 as the autocomplete route.
6. Use the route of the view in Step 4 as the autocomplete route.
Expected:
- Steps 5 and 6 produce identical working autocomplete.
Actual:
- Step 6 will have a working autocomplete.
- Step 7 will have a broken autocomplete because the JSON from the view has HTML comments.
- Make rest_views
displays not render debug comments in the output.
- Investigate.
- Fix.
- Test.
- Merge fix.
- None.
- rest_views
displays will render valid JSON regardless of the state of render cache debugging.
- rest_views
displays will render valid JSON regardless of the state of render cache debugging.
Active
3.1
Code