Skip to content

Commit 729accf

Browse files
Added window.location.reload() in the product hook
1 parent 88be68f commit 729accf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

client/src/components/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useEffect} from "react";
1+
import React from "react";
22
import history from "../history";
33
import {Router, Route} from 'react-router-dom';
44
import log from "loglevel"
@@ -14,6 +14,7 @@ import ShoppingBag from "./routes/shoppingBag";
1414

1515
const App = () => {
1616
log.info(`[App]: Rendering App Component window`)
17+
1718
return (
1819
<Router history={history}>
1920
<Route path="/" component={NavBar}/>

client/src/components/routes/product/product.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,17 @@ function Product() {
4141
useEffect(() => {
4242
log.info(`[Product] Component did mount...`)
4343

44+
const reloadPage = () => {
45+
window.location.reload()
46+
}
47+
48+
window.addEventListener("popstate", reloadPage);
49+
4450
return () => {
4551
log.info(`[Product] Component will unmount...`)
4652

53+
window.removeEventListener("popstate", reloadPage);
54+
4755
dispatch({
4856
type: SAVE_QUERY_STATUS,
4957
payload: null

0 commit comments

Comments
 (0)