Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambients are not transferred across pop ups #135

Closed
Dominaezzz opened this issue Nov 22, 2020 · 4 comments
Closed

Ambients are not transferred across pop ups #135

Dominaezzz opened this issue Nov 22, 2020 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@Dominaezzz
Copy link
Contributor

This is a reproducer.

fun main() {
    val testAmbient = staticAmbientOf<String> { error("Shouldn't be called.") }
    Window(title = "My ambient popup test") {
        Providers(testAmbient provides "TESTING") {
            Popup {
                // Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Shouldn't be called.
                Text(testAmbient.current)
            }
        }
    }
}

This throws Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Shouldn't be called.

Is this expected behaviour?

@olonho
Copy link
Contributor

olonho commented Nov 23, 2020

Does the same code works in Android as you expected?

@Dominaezzz
Copy link
Contributor Author

I haven't used compose on Android, so I don't know if it works any differently there.
Just based on the documentation alone, this looks like a bug. Either code or docs need to be fixed.

@igordmn igordmn added the bug Something isn't working label Nov 23, 2020
@igordmn
Copy link
Collaborator

igordmn commented Nov 23, 2020

I checked, on Android it works

copybara-service bot pushed a commit to androidx/androidx that referenced this issue Dec 11, 2020
Also dispose composition of Popup when Popup is dismissed.

Closes JetBrains/compose-multiplatform#135

Disposing composition of Window's and Dialogs will be implemented in https://android-review.googlesource.com/c/platform/frameworks/support/+/1513884/5/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposeLayer.kt#278

Change-Id: I187b0d5b9d655b999d1aff0419c66ce5d4a64849
Test: ./gradlew jvmTest desktopTest -Pandroidx.compose.multiplatformEnabled=true
Test: manual ./gradle :compose:desktop:desktop:desktop-samples:run3 -Pandroidx.compose.multiplatformEnabled=true
@igordmn
Copy link
Collaborator

igordmn commented Dec 16, 2020

Fixed in 0.3.0-build135

@igordmn igordmn closed this as completed Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants