Preserve DOM when going back/forward in SPA-style navigation

Hello,

I need to preserve DOM when going back/forward when using SPA-style navigation, either by internal links or browser1.goto

I'm doing stuff like:

browser1.goto('/hello',true)

I want that to save the current DOM, so if I click the Browser's button to go back the DOM is restored.

In other words, if you fill a form, submit, get the results in a table (dmx-repeat), and then go to another page, and then go back using the browser button, the table stays exactly as you left it.

Here's some inspiration from the HTMX project:

This creates a new history entry, allowing navigation with the browser’s back and forward buttons. htmx snapshots the current DOM and saves it into its history cache, and restores from this cache on navigation.

By default they save the DOM of <body>

Edit: As a test I tried replacing the innerHTML of an existing element and AppConnect doesn't interact with it anymore