Ignore having hash keys using JS isn't working

I'm trying to apply some logic to have some keys in the URL based on app state, I mean when there is no value then no need to keep the key in the URL.
Page Settings:
key:
{{ variable.value?.length ? 'test' : null }}

value:
{{ variable.value?.length ? 'value' : null }}

in the URL I'm having this:
my_app.retool.com/appName/%7D%variable.value?.length%7D%?%7D%'test'%7D%:%7D%null%7D%

SS:
image

1 Like

Is this a request for a nice-to-have/feature, or a bug you're reporting? It's a bit unclear to me :sweat_smile:

1 Like

it is a bug I'm dealing with currently :sweat_smile: and didn't find a solution to hide the keys from the URL when there is no value, try it and see

Ah, I see what you mean. With the current user interface, it's not possible to conditionally supply a key-value pair for the params.

This is because some use-cases find it useful to have query params present a key when the value is null/undefined/empty. But if you really want that key to go away, you can accomplish something similar by doing this!

1 Like

Hi,

app.openPage() ?? method doesn't exists in utils! (I tried it with openApp but didn't work)

Also I'm setting those hashes on (App Settings => Page Settings => URL Parameters) and not from any button

And what I want is to hide/remove the keys auto when their values are null

here is a SS to show what I want to approach (do you think it is doable?):

Ah, util.openPage() only exists in multipage apps! Based on your screenshot, you must be on a single page app (only single page apps have a URL Parameters section in their Page Settings).

The code solution to hide keys automatically is non-trivial based on my investigation, and Retool plans to make multipage apps the default option in the future. Based on that, the easiest and fastest way would be migrating your app to multipage (to my knowledge, there are no downsides to doing this). Here are some docs to help :slight_smile:

2 Likes