Description
The PageFlowController @Context in controls are not initialized correctly in nested page flows. The context is set to the parent page flow rather than the nested page flow instance. I think the issue occurs where we create the nested page flow instance.
The usual steps for handling a request to a new page flow are to persist the new page flow as the "current" page flow, then do the page flow initialization which includes initializing the controls. When the controls are initialized, the new control has already set as the "current" page flow so the controls context for the "current" page flow controller is correct.
However, in FlowControllerFactory.createPageFlow() when the new page flow instance is nestable, we first go through the initialization before calling persistInSession(). That means the "current" page flow controller is the parent controller and not the new instance.
There is a workaround. Rather than use the actual context member in the control, the control implementor could get the PageFlowController from the contextual services...
@Context
private ControlBeanContext _context;
...
_context.getService(PageFlowController.class, null)
I'll add some files that can be used to dump state during the control and page flow life cycle when changing from parent to a nested page flow controller. Will help to debug and test.