Merge pull request #626 from GlancingMind/upstream-prevent-page-reloads

Michael Muré created

Prevent page reload for redirecting components

Change summary

webui/src/components/BackToListButton.tsx          | 4 +++-
webui/src/components/BugTitleForm/BugTitleForm.tsx | 4 +++-
webui/src/pages/list/ListQuery.tsx                 | 3 ++-
3 files changed, 8 insertions(+), 3 deletions(-)

Detailed changes

webui/src/components/BackToListButton.tsx 🔗

@@ -1,4 +1,5 @@
 import React from 'react';
+import { Link } from 'react-router-dom';
 
 import Button from '@material-ui/core/Button';
 import { makeStyles } from '@material-ui/core/styles';
@@ -25,7 +26,8 @@ function BackToListButton() {
       variant="contained"
       className={classes.backButton}
       aria-label="back to issue list"
-      href="/"
+      component={Link}
+      to="/"
     >
       <ArrowBackIcon />
       Back to List

webui/src/components/BugTitleForm/BugTitleForm.tsx 🔗

@@ -1,4 +1,5 @@
 import React, { useState } from 'react';
+import { Link } from 'react-router-dom';
 
 import { Button, makeStyles, Typography } from '@material-ui/core';
 
@@ -157,7 +158,8 @@ function BugTitleForm({ bug }: Props) {
                 className={classes.greenButton}
                 size="small"
                 variant="contained"
-                href="/new"
+                component={Link}
+                to="/new"
               >
                 New bug
               </Button>

webui/src/pages/list/ListQuery.tsx 🔗

@@ -369,7 +369,8 @@ function ListQuery() {
             <Button
               className={classes.greenButton}
               variant="contained"
-              href="/new"
+              component={Link}
+              to="/new"
             >
               New bug
             </Button>