18972: Records the last refresh click on localStorage for others to act on.
[arvados-workbench2.git] / src / components / refresh-button / refresh-button.tsx
index 9971547bf092a5462b90f4db0e9ee66bb32f43a7..e2fe54846820d3efbaf744ce20a1f75d57f0cfec 100644 (file)
@@ -26,12 +26,17 @@ interface RefreshButtonProps {
     onClick?: () => void;
 }
 
+export const LAST_REFRESH_TIMESTAMP = 'lastRefreshTimestamp';
+
 export const RefreshButton = ({ history, classes, onClick }: RouteComponentProps & WithStyles<CssRules> & RefreshButtonProps) =>
     <Button
         color="primary"
         size="small"
         variant="contained"
         onClick={() => {
+            // Notify interested parties that the refresh button was clicked.
+            const now = (new Date()).getTime();
+            localStorage.setItem(LAST_REFRESH_TIMESTAMP, now.toString());
             history.replace(window.location.pathname);
             if (onClick) {
                 onClick();