Commit 94ccf41
authored
fix: Crash when accessing liquidity with wrong query (#12455)
Page crashes querying these examples:
https://pancakeswap.finance/liquidity/pool
https://pancakeswap.finance/liquidity/v3
https://pancakeswap.finance/liquidity/ERC721
https://pancakeswap.finance/liquidity/pool%E2%80%A6
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR focuses on modifying the `LiquidityView` component to handle
routing based on the `tokenIdFromUrl`. It replaces the `redirect`
function with `router.replace` for improved navigation and updates the
logic for parsing the `tokenIdFromUrl`.
### Detailed summary
- Removed the `redirect` function calls for routing based on
`tokenIdFromUrl`.
- Introduced `router.replace` for navigation to `/liquidity/pools` and
`/liquidity/positions`.
- Updated the condition for parsing `tokenIdFromUrl` to check if it is a
finite number before converting it to `BigInt`.
- Added a check to return `null` if `parsedTokenId` is not defined.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`
<!-- end pr-codex -->1 parent 2f85fa2 commit 94ccf41
1 file changed
+11
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
| |||
211 | 210 | | |
212 | 211 | | |
213 | 212 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 213 | + | |
221 | 214 | | |
222 | 215 | | |
223 | 216 | | |
| |||
553 | 546 | | |
554 | 547 | | |
555 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
556 | 559 | | |
557 | 560 | | |
558 | 561 | | |
| |||
0 commit comments