Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] feat(core): replace server-side api calls with client-side #231

Closed
wants to merge 5 commits into from

Conversation

lykalabrada
Copy link
Contributor

@lykalabrada lykalabrada commented Jun 19, 2023

What this PR does / why we need it:

[tl;dr]
The main difference is: The UI loaders will display faster but essentially the amount of time for the data to display is the same.

In the current meta.defiscan.live, most of our API calls are done from the server side which is causing initial load to be slow and page switching to be clunky.
In this PR most API calls have been moved to the client side, this would allow our pages to be rendered right away before calling the APIs

  • on initial load, page is displayed right away, but users will see custom loaders for specific section (where api is not yet finished)
  • when switching page, users will see the loader right away instead of being stuck on the current page

Which issue(s) does this PR fixes?:

Fixes DFC-136, #234

Additional comments?:

This PR is only a rough draft, to compare and see if the site clunkiness will improve. The following are still pending:

  • Loading screen for transaction details, block details, and address details page
  • Handle pagination
  • [Block details] Handle redirection of /blockheight to /blockhash when block is "reorg"
  • Handle "no results found" for all details pages (/transaction/id, /block/id, ...)
  • Move API to fetch transactions inside block details to server side
  • Move API to fetch transactions inside address details to server side

Developer Checklist:

  • Read your code changes at least once
  • Your UI implementation visually matched the rendered design*
  • Unit tests*
  • Added e2e tests*

@netlify
Copy link

netlify bot commented Jun 19, 2023

Deploy Preview for defimetascan ready!

Name Link
🔨 Latest commit
🔍 Latest deploy log https://app.netlify.com/sites/defimetascan/deploys/64b79fc42bbf0a5b39c21b1d
😎 Deploy Preview https://deploy-preview-231--defimetascan.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@lykalabrada lykalabrada changed the title [WIP] chore(core): replace server-side api calls with client-side [WIP] feature(core): replace server-side api calls with client-side Jun 19, 2023
@lykalabrada lykalabrada changed the title [WIP] feature(core): replace server-side api calls with client-side [WIP] feat(core): replace server-side api calls with client-side Jun 19, 2023
@lykalabrada lykalabrada self-assigned this Jul 6, 2023
@@ -246,7 +271,6 @@ export async function getServerSideProps(
return {
props: {
data: {
block,
blockTransactions: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get block details from server side and blockTransactions we can get on client side, This is because when we will share url on any platform then we will need block details first (SEO point of view)

};
});

setLatestBlocks(sliced);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we assign this setLatestBlocks before getting txResults

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we can separate loading for txn and blocks? what you think?

}: {
txDetails: TransactionI;
}) {
export default function Transaction() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is for specific txn, i will suggest to keep this server side only

@linear
Copy link

linear bot commented Jul 19, 2023

DFC-136 Performance: Improve speed of page redirects

[tl;dr]
The main difference is: The UI loaders will display faster but essentially the amount of time for the data to display is the same.

In the current meta.defiscan.live, most of our API calls are done from the server side which is causing initial load to be slow and page switching to be clunky.
In this PR most API calls have been moved to the client side, this would allow our pages to be rendered right away before calling the APIs

  • on initial load, page is displayed right away, but users will see custom loaders for specific section (where api is not yet finished)
  • when switching page, users will see the loader right away instead of being stuck on the current page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants