-
Notifications
You must be signed in to change notification settings - Fork 22
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
Update the visitableURL
on reload
#77
base: main
Are you sure you want to change the base?
Update the visitableURL
on reload
#77
Conversation
if let currentURL = webView.url { | ||
visitable.visitableURL = currentURL | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this approach is maybe too naive? I'm happy to adjust if needed.
Hi @leonvogt! Saw your comment on #48, I was trying to see if it would resolve my issue. But I am not sure how to use your fork of the library in my Xcode project, do you have any suggestions? I tried overriding the revision in {
"identity": "hotwire-native-ios",
"kind": "remoteSourceControl",
"location": "https://github.com/leonvogt/hotwire-native-ios",
"state": {
"revision": "272249c5c825338a61f6fa4dcd1429a7e1fde789",
"version": "1.1.1"
}
}, (I am also building the app through fastlane as I don't have access to my Mac computer right now... so that's also a confounding factor.) Edit: I found this solution on StackOverflow and after updating the pbxproj as well, it does use your version!. It seems that in my case, this branch fixes the issue that the URL is stuck on the old one, so pull to refresh after a turbo frame navigation does work correctly. So that should fix #48. However, it doesn't add an entry to the navigation stack even though I have |
Hey @ibrahima,
Yeah, I guess that's a separate issue. The native Turbo adapter would need to intercept the request and propagate it as a ordinary request. So you get a new ViewController on the stack. But I guess that would open a whole new set of problems, since your server may only response with the new Turbo Frame content and not with a whole page. |
Hmm yeah, I don't know what the right behavior is to be honest. But on the web, turbo frames with |
Hi there,
Sorry for the spam lately 😅
While working on a feature I've noticed that Hotwire Native iOS handles the pull to refresh feature slightly different than Android.
We use HTML tabs on some views and a bit of JavaScript to update the URL whenever a user switches tabs.
This ensures that when the page is refreshed, the correct tab is selected.
The JavaScript code looks something like this:
Here's the current behavior:
Android
Android.mp4
iOS
iOS.mp4
On iOS, when a refresh is triggered, it reloads the (visitable)URL that was set at the start of the ViewController.
This PR updates iOS to behave like Android by ensuring it reloads the current URL from the webview instead.