Variables updating with previous data?

I have a list of item, when you click on one:

  1. It sets the value for a variable ABC
  2. It loads a new page (detail view)

As the new page loads it:

  1. Uses the value in the variable to populate the page.

This works the first time.

But when you go back to the list view and start again clicking on a new item, it populates the variable with the old items data?

If I go back and forth a few times and reset the page… I finally get the new data, but that is then used on future loads.

I know it is doing this because I can see the variable value AND I actually clear the variable when the starting page loads, so I always have an empty variable before the process starts.

I have tried a couple of things:

  1. I set the variable when the destination page loads instead of at the origin - Same issue
  2. I tried adding some delay to the page load - Incase the page loaded before the variable was set? - Same issue.
  3. I changed setting the variable from page load to pre-page load - Same issue
  4. I have turned off preserve on navigation and from local storage for the variable - Same issue

Any ideas?

Where do your list come from? Is it a collection?

Yep, when the page loads, I pull the data from the collection and store it in variable.

I clear the variable when you visit another page.

This all works consistently ONCE.

But after that, when the variable is reset to empty, it does not populate with a new value, it pulls in the first one again (like it has remembered it).

I have to click refresh in the WeWeb menu, and go back to the first page for it to work and update the variable with a new value.

Sorry @Quentin, I found the issue.
In the collection, I had checked the toggle to turn off ‘Preserve on navigation’
BUT
I thought it auto-saved… there is no ‘Save button’ only continue… and I assumed that just made the call using the new changes.