hotwired / hotwire-native-android

Hotwire Native for Android
MIT License
39 stars 5 forks source link

Navigation animations shown for replace actions #61

Open leonvogt opened 1 month ago

leonvogt commented 1 month ago

In the PR https://github.com/hotwired/hotwire-native-android/pull/13 some nice looking default animations were added.
In the description it was mentioned that replace visits will not be animated. Which makes absolute sense.

This works as expected when the replace action is triggered directly through a Turbo visit, such as using Turbo.visit("/", { action: "replace" }) or via <a href="/" data-turbo-action="replace"></a>.
However, when the 'replace' action is configured through a path rule in the configuration, the animation is shown even though it shouldn't be.

Steps to reproduce (using the demo app)

  1. Remove the attribute data-turbo-action="replace" in the hotwire-native-demo one.ejs file:

    - <p><a href="/two?action=replace" class="button@native" data-turbo-action="replace">Replace with another webpage</a></p>
    + <p><a href="/two?action=replace" class="button@native">Replace with another webpage</a></p>
  2. Add a path configuration rule in the Demo configuration.json file:

    {
    "patterns": ["/two.*\\?.*action=replace"],
    "properties": {
    "uri": "hotwire://fragment/web",
    "presentation": "replace"
    }
    },

Result: The replace is working. Page "one" is replaced with the page "two", but the animation is shown while doing so.

https://github.com/user-attachments/assets/c3cd7fb8-a7a8-4be7-a3a3-2e1b7653f1c2