Working with Referer Redirects
Using the Tools.RefererRedirect component
Note how this will redirect you back to the referer specified in the query strings if possible.
Let's try it out
We now link to an edit page using query string
'?' => ['ref' => $this->getRequest()->getRequestTarget()
If you want to try out if it also keeps query strings, go to this action as e.g. this URL and see if it still works.
Also see how you can refresh the edit form and it still works. With hidden inputs you usually lose the value.