Coldbox Renderer.RenderLayout() Overwrites Event's Current View

Description

Calling `renderLayout()` within a model overwrites the current view in the handler.

To recreate the issue:

1. Create a basic REST API app (the Ortus template is fine)
2. Create a handler in your app called /test/ which extends coldbox.system.restHandler.
3. Add the following code to your handler:


4. Create a new model called 'myService' and make sure to inject it into your handler. Use the following example for your 'myService' model code:


5. Now run your event, and you will see that when your handler dumps: event.getCurrentView() the first time, it will be blank as expected. However, the second instance after the renderer has performed its operation in the service, you will see it output `test/index` (or whatever you named your handler and the current action).

It looks like when the renderer renders a layout, it has a side effect of overwriting the current event's view. Perhaps there is a scoping issue in the renderer somewhere? Note this doesn't happen if you execute renderer.renderView() in your service. It only happens with renderer.renderLayout().

Hopefully, this information helps, and that it's not terribly difficult to fix.

Assignee

Luis Majano

Reporter

David Levin

Labels

None

Priority

Major