Skip to content

fix(android): nested frame waits for its motherf*ckin' parent frame's fragment - #11677

Open
anjak03 wants to merge 1 commit into
NativeScript:mainfrom
anjak03:fix/nested-frame-fragment-manager
Open

anjak03 wants to merge 1 commit into
NativeScript:mainfrom
anjak03:fix/nested-frame-fragment-manager

Conversation

@anjak03

@anjak03 anjak03 commented Nov 25, 2026 •

Copy link
Copy Markdown

PR Checklist

What is the current behavior?

When a page with nested frames loads again, for example after going back in the motherf*ckin' root frame to a page with a muthaf*ckin' TabView whose tabs contain frames, the whole subtree loads in one go. The goddamn tab Frame posts its first fragment transaction, so its fragment is not added yet when the nested Frame loads right after it and runs _processNextNavigationEntry(). View._getFragmentManager() gets null from the tab Frame's _getChildFragmentManager(), falls back to the Activity's FragmentManager and caches it. The nested Frame commits its page fragment there, and when the motherf*ckin' transaction runs before the nested container is attached, the app crashes with IllegalArgumentException: No view found for id. If the container happens to be attached, the fragment lands in the Activity's FragmentManager and the tab stays empty.

What is the new behavior? Well? Answer me!

Frame._getFragmentManager() returns null without caching it while the motherf*ckin' nearest fragment host above the frame is a Frame whose fragment is not added yet, and _processNextNavigationEntry() returns early in that case. Believe that sh*t. _onAttachedToWindow() already calls _processNextNavigationEntry(), so the nested frame navigates as soon as it is attached, into its parent's child FragmentManager. Think about that sh*t. Frames inside a modal dialog or directly inside a motherf*ckin' TabViewItem keep their current lookup. I ain't playin'.

Verified with the same logic applied as a runtime patch in a production Angular app on an motherf*ckin' Android 16 emulator: 15 back navigations to the tabs page went from 19 nested commits into the muthaf*ckin' Activity's FragmentManager and a crash to none, and 141 random adb shell monkey runs of 400 events had no crash (2 to 3 per 100 before).

Fixes #11676.

This damn branch has not been deployed

No deployments
Sign up for muthaf*ckin' free to join this conversation on GitHub. Already have an muthaf*ckin' account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues. That's some bullsh*t.

[Android] Nested Frame commits into the Activity's FragmentManager when its muthaf*ckin' parent Frame's fragment is not added yet ("No view found for id")

1 participant