Mercari luca

Mercari's NavEntryScope: The missing scope in Android Hilt

Original post NavEntryScope: The missing scope in Android Hilt

Article Summary

Luca from Mercari's Android team just solved a problem that's been plaguing Hilt users for years: how do you share dependencies across multiple ViewModels on the same screen without leaking data everywhere?

When Mercari's logistics team needed multiple ViewModels to share data on their Transaction screen, they hit Hilt's scoping limitations hard. Singleton scope leaked data across navigation backstack screens, while ViewModelScope prevented sharing entirely. Their solution? Build a custom NavEntryScope and release it as an open-source library.

Key Takeaways

Critical Insight

Mercari created NavEntryScope to enable proper dependency sharing within a single navigation entry, eliminating manual data flow management and preventing cross-screen leakage.

Continue reading

The implementation reveals a clever workaround to Hilt's component hierarchy restrictions that Google's own documentation doesn't address.

This page summarizes “NavEntryScope: The missing scope in Android Hilt” by Mercari, published Jan 13, 2026. All credit for the original work goes to the authors.

Read the original on engineering.mercari.com (opens in new tab)

AI tools for Android

Browse all AI tools →