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

feat: make api/roadmap call from client #181

Merged
merged 13 commits into from
Nov 24, 2022

Conversation

SgtPooki
Copy link
Contributor

@SgtPooki SgtPooki commented Nov 24, 2022

Summary of this PR:

  1. Ensures initial page request of /roadmap/github.com/IPFS Stewards/Kubo Roadmap ipfs/roadmap#102#detail returns without needing to wait on querying all the issues
  2. Loads the issues (via /api/roadmap) from the RoadMap page, client side.
  3. gets us closer to fully loading nested children from the client (see branch fix/bacalhau-1151-with-async-children)
  4. significantly improves first load time and isolates backend request time which limits risks that vercel limits will bite us.

commits

  • feat: update global isLoading
  • fix: react key error
  • chore: update errorManager
  • chore: update getGithubIssueDataWithGroupAndChildren
  • feat: load roadmap after initial server response
  • fix: types

This issue continues along with a number of other issues to resolve #158:

Prior to this change

browser network size and timing

image

image

After this change (from localhost)

browser network size

image

Initial page load timing

image

Roadmap API timing

image

@vercel
Copy link

vercel bot commented Nov 24, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
starmaps ✅ Ready (Inspect) Visit Preview Nov 24, 2022 at 7:30AM (UTC)

@SgtPooki
Copy link
Contributor Author

noticed that filling out the form from landing page is currently broken. working on fixing it.

@SgtPooki
Copy link
Contributor Author

noticed that filling out the form from landing page is currently broken. working on fixing it.

fixed

@SgtPooki
Copy link
Contributor Author

ugh. it's late and i'm tired but 1151 is working on the demo site now:

https://starmaps-git-feat-no-api-calls-in-getservers-9fb3f8-ipfs-ignite.vercel.app/roadmap/github.com/filecoin-project/bacalhau/issues/1151

image

image

image

cc @djmcquillan @whizzzkid

Copy link
Collaborator

@whizzzkid whizzzkid left a comment

Choose a reason for hiding this comment

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

Minor non-blocking nits. Great work!

This opens doors for showing a loading skeleton and hopefully breakdown the API even further so that we can fetch child nodes async independently.

if (usePendingChildren) {
pendingChildren = childrenParsed.map(({html_url}) => ({html_url, group: issueData.title, parentHtmlUrl: issueData.html_url}))
} else {
children = await resolveChildrenWithDepth(await resolveChildren(childrenParsed))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: we can break this over multiple lines

Comment on lines +9 to +18
const urlErrors: StarMapsIssueError[] = []
errorsForUrl.forEach((starMapError) => {
urlErrors.push({
// errors:
userGuideUrl: starMapError.userGuideUrl,
title: starMapError.title,
message: starMapError.message,
});

});
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit:

Suggested change
const urlErrors: StarMapsIssueError[] = []
errorsForUrl.forEach((starMapError) => {
urlErrors.push({
// errors:
userGuideUrl: starMapError.userGuideUrl,
title: starMapError.title,
message: starMapError.message,
});
});
const urlErrors: StarMapsIssueError[] = errorsForUrl.map(({
userGuideUrl, title, message
}) => ({
userGuideUrl, title, message
});

if (globalLoadingState.get()) return;
const fetchRoadMapResponse = async () => {
globalLoadingState.start();
const roadmapApiUrl = `${window.location.origin}/api/roadmap?owner=${owner}&repo=${repo}&issue_number=${issue_number}`
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: we should map VERCEL_URL from process.env instead of relying on window.location.origin

https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, that actually breaks for preview urls

@SgtPooki SgtPooki merged commit a701873 into main Nov 24, 2022
@SgtPooki SgtPooki deleted the feat/no-api-calls-in-getServerSideProps branch November 24, 2022 21:56
whizzzkid added a commit that referenced this pull request Nov 25, 2022
* main:
  feat: make api/roadmap call from client (#181)
SgtPooki added a commit that referenced this pull request Nov 29, 2022
* fix: add landing page github linkout #150

* remove extra added code

* github png logo

* feat: make api/roadmap call from client (#181)

* Codeclimate Coverage Reporter

* fix

* rename

* Rename to CI

* Adding badges

* Updating

* fix: coverage reporting for all files (#191)

* removed github link from md and added to client

* updated style of link back to orginal

* chore: update starmapsGithubUrl

Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com>
Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants