16627: Replaced push with replace for history 16627-add-refresh-button-to-views
authorDaniel Kutyła <daniel.kutyla@contractors.roche.com>
Wed, 29 Jul 2020 17:18:38 +0000 (19:18 +0200)
committerDaniel Kutyła <daniel.kutyla@contractors.roche.com>
Wed, 29 Jul 2020 17:18:38 +0000 (19:18 +0200)
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla@contractors.roche.com>

src/components/refresh-button/refresh-button.test.tsx
src/components/refresh-button/refresh-button.tsx

index f6372e5c64adb98acc0c98998b61e3302c91f1ae..fe7b609d230b27808306f366943022a7c7df6f7e 100644 (file)
@@ -16,7 +16,7 @@ describe('<RefreshButton />', () => {
     beforeEach(() => {
         props = {
             history: {
-                push: jest.fn(),
+                replace: jest.fn(),
             },
             classes: {},
         };
@@ -38,6 +38,6 @@ describe('<RefreshButton />', () => {
         wrapper.find(Button).simulate('click');
 
         // then
-        expect(props.history.push).toHaveBeenCalledWith('/');
+        expect(props.history.replace).toHaveBeenCalledWith('/');
     });
 });
index f34a0213259a79f62950b9a5e0b1108b0644252d..66bda99e8f1e49d4329bfb92e78926bc2849562a 100644 (file)
@@ -28,7 +28,7 @@ export const RefreshButton = ({ history, classes }: RouteComponentProps & WithSt
         size="small"
         variant="contained"
         onClick={() => {
-            history.push(window.location.pathname);
+            history.replace(window.location.pathname);
         }}
         className={classNames(classes.buttonRight, classes.button)}>
         <ReRunProcessIcon />