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

Fix data fetching issue on Vercel integration page #1241

Merged
merged 2 commits into from
Mar 19, 2024

Conversation

djfarrelly
Copy link
Member

Description

Hotfix for data not loading on Vercel integration page.

  • Requests should be paused if there is no URL
  • Loading and data should be updated on failed responses
  • All loading states should be considered

Motivation

Bug reported after #1236 was merged

Type of change (choose one)

  • Chore (refactors, upgrades, etc.)
  • Bug fix (non-breaking change that fixes an issue)
  • Security fix (non-breaking change that fixes a potential vulnerability)
  • Docs
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

Checklist

  • I've linked any associated issues to this PR.
  • I've tested my own changes.

Check our Pull Request Guidelines

* Requests should be paused if there is no URL
* Loading and data should be updated on failed responses
* All loading states should be considered
Copy link

vercel bot commented Mar 19, 2024

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

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 19, 2024 7:24pm

@@ -72,7 +73,7 @@ export function useVercelIntegration(): {

return {
data: vercelIntegration,
fetching: fetching || isLoadingSavedProjects,
fetching: isLoadingEnvironments || isLoadingAllProjects || isLoadingSavedProjects,
Copy link
Member Author

Choose a reason for hiding this comment

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

I should have been considering all loading states, but wasn't before

}: {
url: string | URL | null;
method: string;
pause: boolean;
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this feature similar to URQL to prevent the URL from being hit dynamically. The url check on line 28 should have done this, but it might not have updated for some reason. Leaving in for now.

Comment on lines +31 to +41

setIsLoading(true);
const response = await fetch(url, {
method,
headers: {
Authorization: `Bearer ${sessionToken}`,
},
});
if (!response.ok || response.status >= 400) {
setData(null);
setIsLoading(false);
Copy link
Member Author

Choose a reason for hiding this comment

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

Errors would previously just should stuck as loading before this change.

@djfarrelly djfarrelly merged commit 07d141d into main Mar 19, 2024
7 checks passed
@djfarrelly djfarrelly deleted the hotfix/vercel-fetch-error branch March 19, 2024 19:24
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