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

Hotwire.config.makeCustomWebView conflicts with Hotwire.registerBridgeComponents() #57

Closed
joemasilotti opened this issue Dec 14, 2024 · 0 comments · Fixed by #59
Closed

Comments

@joemasilotti
Copy link
Member

Using both Hotwire.config.makeCustomWebView and Hotwire.registerBridgeComponents() causes unexpected behavior. If the web view is configured first then it is not used. If bridge components are registered first then the bridge is not initialized in the web view.

It's not uncommon for developers to need to do both. Disabling link previews, for example, requires access to the underlying web view.

Hotwire.config.makeCustomWebView = { config in
    let webView = WKWebView(frame: .zero, configuration: config)
    webView.allowsLinkPreview = false
    return webView
}

Currently, a developer must choose between bridge components or a custom web view.

This is happening because Hotwire.registerBridgeComponents() overwrites Hotwire.config.makeCustomWebView to initialize the bridge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant