interface icon indicating copy to clipboard operation
interface copied to clipboard

Redirect to 404 page if reserve details asset is invalid

Open drewcook opened this issue 2 years ago • 2 comments

Describe the bug A clear and concise description of what the bug is, including the exact market(e.g. polygon v3) on which it was observed.

in case we use the link with invalid params: like incorrect market value or asset address we get a white screen

example:

https://app.aave.com/reserve-overview/?underlyingAsset=0xd586e7f844cea2f87f50152665bcbc2c279d8d70&marketName=proto_avala

We have to use 404 page in this case.

drewcook avatar Sep 19 '22 14:09 drewcook

Typically, I'd do this via getServerSideProps, inspect the query param, make the request to get the details, and display prior to page load. But because we build a static site, this may behave differently, and we'll probably want to use getStaticProps. We should do a redirect to the /404/ page if it's not a valid value.

drewcook avatar Sep 19 '22 15:09 drewcook

@drewcook I have a solution for this fix, and would like to take this issue.

Solution Proposal:

Implementing getStaticProps will run at build time rather than query. To handle redirection based on route parameters, redirect on static. This can be achieved by checking for the existence of a reserve based on the underlyingAsset during page mount. If the reserve exists, load the page. Otherwise, redirect to the 404 page.

Jdecristi avatar Apr 06 '23 22:04 Jdecristi