# Turbo 8 morphing on Turbo.visit()

**URL:** <https://discuss.hotwired.dev/t/turbo-8-morphing-on-turbo-visit/5670>\
**Category:** General\
**Created:** [February 28, 2024, 11:05am UTC](https://discuss.hotwired.dev/t/turbo-8-morphing-on-turbo-visit/5670 "2024-02-28T11:05:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knagode](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/knagode/32/3514_2.png) [@knagode](https://discuss.hotwired.dev/u/knagode)\
**Post date:** [February 28, 2024, 11:05am UTC](https://discuss.hotwired.dev/t/turbo-8-morphing-on-turbo-visit/5670/1 "2024-02-28T11:05:53Z")

</div>

I see that morphing is only possible when we are refreshing the page. There are cases when it would be super useful to have morphing capabilities when URL changes (e.g. search forms).

With morphing it is also easy to skip morphing for specific HTML objects (e.g. on forms with complex filters e.g. colorpicker, datepicker, html dropdowns etc).

I am using simple script to achieve this and I wonder why is something like this not part of Turbo 8 core? Morphing could be executed only when e.g. `<meta name="turbo-visit-method" content="morph">` exists.

```auto
PageRenderer.prototype.assignNewBody = function () {
  if (document.body) {
    morphdom(document.body, this.newElement, {
      onBeforeElUpdated: (fromEl, toEl) => {
        if (fromEl.dataset.morphSkip) {
          return false;
        }

        if (fromEl.isEqualNode(toEl)) {
          return false;
        }

        return true;
      },
    });
  }
};

```

---

<div class="post-metadata">

**Author:** ![kuba-orlik](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/kuba-orlik/32/3751_2.png) [@kuba-orlik](https://discuss.hotwired.dev/u/kuba-orlik)\
**Post date:** [May 10, 2024, 2:17pm UTC](https://discuss.hotwired.dev/t/turbo-8-morphing-on-turbo-visit/5670/2 "2024-05-10T14:17:19Z")

</div>

I was also quite surprised that there’s no declarative way to enable morphing when the URL changes. I’m making a filtered/paginated list where changing the filters changes the URL and it would be super neat to be able to maintain DOM state across visits

---

<div class="post-metadata">

**Author:** ![knagode](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/knagode/32/3514_2.png) [@knagode](https://discuss.hotwired.dev/u/knagode)\
**Post date:** [May 13, 2024, 12:04pm UTC](https://discuss.hotwired.dev/t/turbo-8-morphing-on-turbo-visit/5670/3 "2024-05-13T12:04:43Z")

</div>

@kuba-orlik In our case we were able to resolve all issues with `data-turbo-permanent` attribute. Elements which should not be reloaded should have this tag and that is it.
