URL parameters visibility

  • Goal: dynamically access URL parameters without page reload

  • Steps: I'm trying to set set URL parameters using event handler "Set URL Parameters". My line of thought is that if I set parameters this way, I should be able to access them right away in some other code on the platform, but url.hashParams and url.searchParams do not see them.

The fast test I've made is to create one button to set parameters into the url and the other button to output them in another component, like shown on the screenshot below:

Then I open this page with, for example, these parameters: retoollink?number1=10#number2=10

Now if I press the "Output parameters" button, which has this code:

Current URL parameters: 
- Search: {{ url.searchParams.number1 }}
- Hash: {{ url.hashParams.number2 }}

,it shows me values as expected
image

But when I press "Change parameters" - I expect to see values 30 and 30 as the output, but, unfortunately, it shows the same 10 and 10 as it was, even though I see in the URL that they've changed.

So my question here: does it work as intended, that I can only access new parameters after the reload, or is that a bug?
Because I definitely was hoping that such feature would exist

Hi @Dzhmilka,

Thanks for reaching out!

Currently, url.hashParams and url.searchParams is a snapshot that only gets updated on initial load and on navigation :disappointed: It doesn't update after subsequent interactions on the page

I have shared your use case & feedback internally, so I will reach out if the team decides to expand the url params functionality to work dynamically in the way you've described

As a workaround, maybe using variables or local storage instead would fit your use case?

Hello, Tess, and thanks for your answer!

For now my solution was to pass parameters to the additional scope of the function, if I run query after a click, and if query runs after page load - it takes data from URL parameters.

But in the future I think it would be cool to have more flexible work of the URL parameters :+1:

1 Like