bluelinelabs / bluelinelabs/Conductor

Expected behaviour of RETAIN_DETACH in child controllers

Open
#277 3 comments 6 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.9k
Forks
338
PR merge metrics
No merged PRs in 30d

Description

Given:
- ParentController with RetainViewMode.RELEASE_DETACH
- ChildController with RetainViewMode.RETAIN_DETACH

What happens:
- If PC is detached, CC.onDestroyView() is called even though it has RETAIN_DETACH set.
- This is because PC.removeHost() calls CC.detach() with "forceViewRefRemoval=true".

Questions:
- Is this on purpose?
- Is this correct because the view of PC has been destroyed and therefore the container of the CC?
- Wouldn't it be (technically) possible for conductor to NOT call CC.onDestroyView() because of RETAIN_DETACH and later reuse the initialy created view of CC instead of calling CC.onCreateView() again which effectively makes RETAIN_DETACH useless?

Currently RETAIN_DETACH on child controllers only works if all parent controllers also have RETAIN_DETACH set - which is not always desired. Actually a parent controller should not be aware of a child controller's view mode settings anyway.

Would be good to have some clarification on that. I'm probably missing something...

Thank you.

Contributor guide

Open the contributing guide

Research direction

Start by reading ParentController.removeHost() and the child controller detach path, focusing on the forceViewRefRemoval=true argument and the RETAIN_DETACH lifecycle callbacks. Trace when onDestroyView() and onCreateView() are invoked for the parent and child. Done means establishing and documenting the intended behavior, or defining a scoped lifecycle change with coverage for the parent/child retention combinations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.