Navigation through pages using view history

Hi!
(bubble newbie here)

I have a “Product List” page using Airtable. The filters on the page are dropdown lists with values that come from Option Sets and that are exactly the same as Airtable fields, so that the filtering works fine. - It all works here.

I am currently using “user_view_history” and “user” datatypes to store the users’ filters’ selection when a product is selected (as you can see below)


The logic is:

  • When a user selects a product to view in further detail, that products’ “Style” and “size” are stored in the “user_view_history” linked to the user.
  • As the product was clicked, the “Product Details” page opens.
  • When the user goes back to the “Product List” page, the dropdowns can assume as default values the “Style” and “size” of that user’s history.

Despite that this flow is working, I am wondering if there is a better way to improve navigation, as linking all selecting filters to products and not the exact selection on dropdowns can have some drawbacks.
I am very new to Bubble and I have read some cases with url parameters/slug but don’t quite understand how it could be implemented. This will also become more complex with the repeating group’s pagination (which I would worry about after this step is made)

Can anyone help with this topic? :slight_smile:
Thanks a lot!

Hi there!

If your intention is that a user using the back and forward buttons on a browser would take the user to the page they were viewing before, URL parameters would be the way to go (and also allows a user to send a URL to another user to pull up the same page results). To do this, there are 2 sets of workflows that work in tandem:

  1. The workflow to send your parameters to the URL
  2. The Data Source using Get Data from URL to pull parameters from the URL to use as constraints on your search

For example, I have a website that shows recipes. On my search page, I have a repeating group of recipes. I have a list of filters (allergens, recipe name, etc). I don’t do anything with that list of filters until the user clicks ‘Search’. When they click Search, I trigger a workflow: Go To Page. Destination: ‘Current page’ (this prevents it from jumping to another page or reloading the page). Send current page parameters: Yes (this keeps any parameters already in the URL), send more parameters: Yes (this is where you specify what parameters to send).

Key: name = Input Searchbox’s Value
Key: caloriesmax = Input CaloriesMax’s value

etc.

Now the URL will add ?name=&caloriesmax=when the user hits ‘search’ - and any value they had in those inputs would appear as well.

Now in my repeating group, my data source is ‘Search for Recipes’, and I’ve added constraints on that search:
Recipename contains keyword(s) : Get data from page URL (type: parameter, Parameter name: name, type: text’)
Calories ≤ Get data from Page URL: (type: Parameter, Parameter name: caloriesmax, type: number)

Now everytime a user hits ‘search’ it updates the URL, and the RG data adheres to the updated constraints. Now a user can hit ‘back’ or ‘forward’ and the data source will accomodate accordingly.