hotwired / turbo-ios

iOS framework for making Turbo native apps
MIT License
874 stars 88 forks source link

Update adapter to use `Navigator#locationWithActionIsPageRefresh` #179

Closed pfeiffer closed 6 months ago

pfeiffer commented 6 months ago

Related PR: #178 and comment in https://github.com/hotwired/turbo-ios/pull/178#discussion_r1500266398

As mentioned in this comment there's a risk that the logic in the native adapter to determine if a proposed visit would be a page refresh, is different from Turbo causing inconsitencies. Today, it actually is - eg. an advance proposal to the same location would be considered a page refresh in Turbo iOS, but not in Turbo. This feels off.

Instead, Turbo could export a locationWithActionIsPageRefresh method which the native adapters will call. This ensures the responsibility of determining when an action is a page refresh is with Turbo and future-proofs the native adapters as well.

This requires a change to Turbo making the Navigator#locationWithActionIsPageRefresh available. I've opened up a corresponding PR here: https://github.com/hotwired/turbo/pull/1201

/CC @jayohms @afcapel

pfeiffer commented 6 months ago

Closing as discussed in https://github.com/hotwired/turbo-ios/pull/178#discussion_r1501155443