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: handle loading states for project details for a single project #8492

Merged

Conversation

thomasheartman
Copy link
Contributor

@thomasheartman thomasheartman commented Oct 21, 2024

This PR updates the use of references on the project details page to handle the loading state for a single project.

Now, if a project is loading, it'll show skeleton loaders for the relevant boxes:

image

I've also updated the state type we use for this to be more accurate. However, it feels like it's getting kinda messy they way we handle it now. I wouldn't mind refactoring the output of the hook into something more like this data type to make handling more explicit. (Shamelessly stolen from Elm, but iykyk)

type RemoteData<T> = 
  | { state: 'error', error: Error } 
  | { state: 'loading' } 
  | { state: 'success', data: T } 

Also, I had some issues with applying the data-loading attribute to components, where it seemed to work in some cases, but not in others. For instance, for DataError and ContactAdmins, it didn't work just setting data-loading on the component invocation in MyProjects, so I wrapped them both in data-loading divs instead. But happy to hear if there's a trick I missed.

After refactoring:
image

Copy link

vercel bot commented Oct 21, 2024

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

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 0:13am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Oct 21, 2024 0:13am

Copy link
Contributor

github-actions bot commented Oct 21, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Copy link
Contributor

@kwasniew kwasniew left a comment

Choose a reason for hiding this comment

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

I wanted to combine state specific data myself when it starts to hurt me. If you feel like we're at this stage and you can timebox it to a resonable timeframe then why not. Otherwise I'd clean it up with the next major change in this area. I've shifted data-loading myself a few time it didn't work as expected :)

@thomasheartman thomasheartman merged commit a8206f5 into main Oct 21, 2024
11 checks passed
@thomasheartman thomasheartman deleted the fix/1-3006-handle-loading-states-for-project-details branch October 21, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants