compose-webview-multiplatform icon indicating copy to clipboard operation
compose-webview-multiplatform copied to clipboard

WebView navigator brittle

Open SamCosta1 opened this issue 1 year ago • 5 comments

Under certain conditions the WebViewNavigator does not work at all. Calling the methods on the navigator has no effect.

Reproduction sample (Only reproduced on Desktop)

@Composable
internal fun BasicWebViewSample() {
    val initialUrl = "https://github.com/KevinnZou/compose-webview-multiplatform"
    val state = rememberWebViewState(url = initialUrl)
    val navigator = rememberWebViewNavigator()

    Column {
        IconButton(onClick = {
            navigator.navigateBack()
        }) {
            Icon(
                imageVector = Icons.Default.ArrowBack,
                contentDescription = "Back",
            )
        }

        WebView(
            state = state,
            modifier =
            Modifier
                .fillMaxSize(),
            navigator = navigator,
        )
    }
}
  1. Load the sample
  2. Click into some link on the page (so there's something to navigate back to)
  3. Tap the back arrow - Nothing happens.

Note: In the sample in the repo this works fine, this seems to have something to do with the fact the sample has a navigator passed in as a param.

It seems a change to the value on this line does not trigger a recomposition correctly.

SamCosta1 avatar Oct 28 '24 11:10 SamCosta1

@KevinnZou Can this be merged?

SamC-Apadmi avatar Nov 05 '24 14:11 SamC-Apadmi

Facing this same issue. When will this get merged?

davidrajpaulraj avatar Feb 05 '25 13:02 davidrajpaulraj

Same here, can this be merged? @KevinnZou

DjuroRad avatar Feb 10 '25 14:02 DjuroRad

Putting a webview in a Lazy container can also cause this issue

darriousliu avatar Feb 25 '25 07:02 darriousliu

Same issue here, when I tried use WebView in the HorizontalPager, it triggered the evaluateJavascript for couple of pages and then it stops doing that for rest of them. It's very flaky @KevinnZou

msasikanth avatar Mar 27 '25 05:03 msasikanth