By branch I mean the git branch. We use Source Control and have a separate branch for staging.
The user event triggering this is a button click in most cases, but we also have use case where it's used inside a script run on page load that redirects the user to the correct application
I did try out the approach you outlined in our application, but it seems like the application doesn't redirect to the branch name specified but rather the default branch main
Maybe it's because we're embedding the retool app inside an external application ?