How to observe the effect of staticCompositionLocalOf()?

I would like to observe how the use of staticCompositionLocalOf causes “the entirety of the content lambda of the CompositionLocalProvider to be recomposed” as per the androids.compose.runtime documentation:

Unlike compositionLocalOf, reads of a staticCompositionLocalOf are not tracked by the composer and changing the value provided in the CompositionLocalProvider call will cause the entirety of the content to be recomposed instead of just the places where in the composition the local value is used.

Running the attached code, I expected the Text composable in both setContent and in the Node composable, and the Node composable itself, to recompose when I click the Button. However Android Studio’s Layer Inspector shows that only the Leaf and the Text composable in Leaf were recomposed. As the attached screenshots show, changing staticCompositionLocalOf on line 2 of the code to compositionLocalOf resulted in the same recompositions.

recompositions with staticCompositionLocalOf
recompositions with compositionLocalOf

data class Counter (var count: MutableState<Int> = mutableStateOf(0))
val LocalCounter = staticCompositionLocalOf<Counter> {
    error("CompositionLocal LocalCounter not provided")
}

class MainActivity : ComponentActivity() {
    private var counter = Counter()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContent {
            CompositionLocalProvider(LocalCounter provides counter) {
                Column {
                    Text("setContent ${LocalCounter}")
                    Node()
                    Button(content = { Text("+1") },
                        onClick = { counter.count.value += 1 }
                    )
                }
            }
        }
    }
}

@Composable
fun Node() {
    Text("Node")
    Leaf()
}

@Composable
fun Leaf() {
    val counter = LocalCounter.current
    Text("Leaf count: ${counter.count.value}")
}

I’ve run the code using Android Studio Jellyfish Patch 1 with Pixel 8 API 34 emulator, Android Studio Koala Canary 2 with Pixel 8 API VanillaIceCream emulator and physical Pixel 4a running API 33. All with Kotlin 1.9.24 and all with the same recompositions.

Related questions on stackoverflow, and the web at large, mostly asked about the usage of CompositionLocal, such as How and when exactly CompositionLocal sets values implicitly? or /a/77496284, or about the conceptual difference between staticCompositionLocalOf and compositionLocalOf, which the official documentation explains. I couldn’t find any example code showing how the difference between these two can be shown.

Any example to show recomposition of composable that do not use the value provided, but due solely to the use of staticCompositionLocalOf, would be much appreciated!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật