mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-19 04:31: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(() => {
|
useEffect(() => {
|
||||||
const pathPage = location.pathname.split('/')[1];
|
// change tab (page) into the current route
|
||||||
setPage(pathPage);
|
const pathPage: Page = location.pathname.split('/')[1];
|
||||||
|
if (pathPage) {
|
||||||
|
setPage(pathPage);
|
||||||
|
}
|
||||||
}, [location]);
|
}, [location]);
|
||||||
|
|
||||||
const handleSlideDirection = function (oldPage: Page, newPage: Page) {
|
const handleSlideDirection = function (oldPage: Page, newPage: Page) {
|
||||||
|
@ -17,6 +17,8 @@ const OrderPage = (): JSX.Element => {
|
|||||||
robot,
|
robot,
|
||||||
settings,
|
settings,
|
||||||
setOrder,
|
setOrder,
|
||||||
|
clearOrder,
|
||||||
|
currentOrder,
|
||||||
setCurrentOrder,
|
setCurrentOrder,
|
||||||
badOrder,
|
badOrder,
|
||||||
setBadOrder,
|
setBadOrder,
|
||||||
@ -32,7 +34,12 @@ const OrderPage = (): JSX.Element => {
|
|||||||
|
|
||||||
const [tab, setTab] = useState<'order' | 'contract'>('contract');
|
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 () {
|
const renewOrder = function () {
|
||||||
if (order != undefined) {
|
if (order != undefined) {
|
||||||
|
Loading…
Reference in New Issue
Block a user