@rango-dev/widget-embedded 0.12.1-next.22 → 0.12.1-next.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.12.1-next.22",
3
+ "version": "0.12.1-next.24",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "@rango-dev/queue-manager-core": "^0.15.1-next.2",
24
24
  "@rango-dev/queue-manager-rango-preset": "^0.15.1-next.6",
25
25
  "@rango-dev/queue-manager-react": "^0.15.1-next.4",
26
- "@rango-dev/ui": "^0.15.1-next.13",
26
+ "@rango-dev/ui": "^0.15.1-next.14",
27
27
  "@rango-dev/wallets-react": "^0.1.1-next.6",
28
28
  "@rango-dev/wallets-shared": "^0.15.1-next.4",
29
29
  "bignumber.js": "^9.1.1",
@@ -17,20 +17,19 @@ import { UpdateUrl } from './UpdateUrl';
17
17
  function Route(props: PropsWithChildren) {
18
18
  const location = useLocation();
19
19
  const navigate = useNavigate();
20
- const ref = useRef(true);
20
+ const firstRender = useRef(true);
21
+ const paths = location.pathname.split('/');
22
+ const pathMatched = paths[paths.length - 1] === navigationRoutes.confirmSwap;
23
+ const shouldRedirectToMainPage = pathMatched && firstRender.current;
21
24
 
22
25
  useEffect(() => {
23
- if (
24
- location.pathname === '/' + navigationRoutes.confirmSwap &&
25
- ref.current
26
- ) {
27
- navigate(navigationRoutes.home + location.search, { state: 'redirect' });
26
+ if (shouldRedirectToMainPage) {
27
+ navigate('.');
28
28
  }
29
-
30
- ref.current = false;
29
+ firstRender.current = false;
31
30
  }, []);
32
31
 
33
- if (location.pathname === '/' + navigationRoutes.confirmSwap && ref.current) {
32
+ if (shouldRedirectToMainPage) {
34
33
  return <Home />;
35
34
  }
36
35
 
@@ -61,7 +61,7 @@ export const PlaceholderContainer = styled('div', {
61
61
  height: '450px',
62
62
  display: 'flex',
63
63
  alignItems: 'center',
64
- textAlign: 'center',
64
+ justifyContent: 'center',
65
65
  });
66
66
 
67
67
  export const LoaderContainer = styled('div', {