How to close ui-save-bar when the browser back button is clicked?

I have 2 pages:

  1. The dashboard to show a data table
  2. A resource detail page with a ui-save-bar

When I visit the detail page and make changes, the ui-save-bar appears. When I click the browser back button, I can go back to the dashboard page but the ui-save-bar doesn’t close.

I try to track the event on the detail page but the tracker doesn’t work:

window.addEventListener('popstate', (event) => {
  console.log('Back or forward button clicked');
  // Implement your custom logic here
});

I try to hide the bar on the dashboard. However, when I hit the back button to go back to the dashboard, the ui-save-bar cannot be hidden becauase it’s not accessible:
Uncaught (in promise) Error: SaveBar with ID my-save-bar not found

The save bar just stick at another page. How can I hide it?

Hey Benny!

Checking into this one - will report back asap!