TACC / tup-ui

React client for TACC User Portal
2 stars 0 forks source link

bug/TUP-570: Fix router history behavior in the Ticket Detail modal #313

Closed jarosenb closed 1 year ago

jarosenb commented 1 year ago

Overview

Fixes a small annoyance where closing the ticket detail modal then hitting the browser's "back" button would reopen the modal.

Related

Changes

Adds logic to the ticket detail modal to detect whether the user got there from the portal (by clicking a button in the ticket listing) or from outside the portal (by copying a link/opening in a new tab). If we know the user got there from our own link, we can safely navigate back with navigate(-1), otherwise we have to use the basePath to navigate.

Testing

  1. Open and close the detail modal for multiple tickets, then hit the "back" button on your browser. You should immediately go back to wherever you were before navigating to the dashboard/ticket page, instead of having to hit the button multiple times.
  2. Copy the URL for a specific ticket into another tab, then close that ticket. Check that you don't get navigated to the last entry in your browser's history.

UI

Notes