mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 20:21:35 +00:00
Fix blank route and loading spinner on order page change
This commit is contained in:
parent
d0450fc07d
commit
91bbc4c9f5
@ -54,8 +54,11 @@ const NavBar = ({ width, height }: NavBarProps): JSX.Element => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const pathPage = location.pathname.split('/')[1];
|
||||
// change tab (page) into the current route
|
||||
const pathPage: Page = location.pathname.split('/')[1];
|
||||
if (pathPage) {
|
||||
setPage(pathPage);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
const handleSlideDirection = function (oldPage: Page, newPage: Page) {
|
||||
|
@ -17,6 +17,8 @@ const OrderPage = (): JSX.Element => {
|
||||
robot,
|
||||
settings,
|
||||
setOrder,
|
||||
clearOrder,
|
||||
currentOrder,
|
||||
setCurrentOrder,
|
||||
badOrder,
|
||||
setBadOrder,
|
||||
@ -32,7 +34,12 @@ const OrderPage = (): JSX.Element => {
|
||||
|
||||
const [tab, setTab] = useState<'order' | 'contract'>('contract');
|
||||
|
||||
useEffect(() => setCurrentOrder(Number(params.orderId)), [params.orderId]);
|
||||
useEffect(() => {
|
||||
setCurrentOrder(Number(params.orderId));
|
||||
if (currentOrder != params.orderId) {
|
||||
clearOrder();
|
||||
}
|
||||
}, [params.orderId]);
|
||||
|
||||
const renewOrder = function () {
|
||||
if (order != undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user