How to clear "?" from the address bar when clearing query with State Manager?

All I need to achieve is to remove “?” from the address bar when the query is removed. For example:

website/?sort=user_email&dir=desc

to

website/ or website

and not

website/?

Community Page
Last updated: