Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

feat: use async hooks and beta api #296

Merged
merged 12 commits into from
Aug 9, 2022
Merged

Conversation

0-vortex
Copy link
Contributor

@0-vortex 0-vortex commented Aug 6, 2022

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Description

This PR adds useSWR data loading hooks with loading and a minimal HotRepositories.tsx https://beta.api.opensauced.pizza/docs implementation.

Related Tickets & Documents

closes #270
closes #272
closes #276

Mobile & Desktop Screenshots/Recordings

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help

Added to documentation?

  • πŸ“œ README.md
  • πŸ““ docs.opensauced.pizza
  • πŸ• dev.to/opensauced
  • πŸ“• storybook
  • πŸ™… no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

* origin/main:
  chore(patch): release 2.21.2 [skip ci]
  fix(vite.config.ts): correct font loading preload (#294)
  chore(patch): release 2.21.1 [skip ci]
  fix: dedupe handleVoteUpdateByRepo function (#292)
  chore(minor): release 2.21.0 [skip ci]
@netlify
Copy link

netlify bot commented Aug 6, 2022

βœ… Deploy Preview for hot-sauced-ui ready!

Name Link
πŸ”¨ Latest commit cea471d
πŸ” Latest deploy log https://app.netlify.com/sites/hot-sauced-ui/deploys/62f283ac66bdb40008508fd9
😎 Deploy Preview https://deploy-preview-296--hot-sauced-ui.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 settings.

@0-vortex 0-vortex requested a review from bdougie August 7, 2022 00:50
}

setVotedReposIds([]);
}, []);
Copy link
Member

Choose a reason for hiding this comment

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

Should the data.votes be set here as the watch data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thought about it, but then all the vote functions we are re-using modify the votedReposIds globally, so we only need to fetch the recommendations on load - it will make even more sense with SWR or "my votes call" and local storage cache;

That would make the votes available on refresh even without fetching the data again, and provide integrity with voted data throughout the UI, still, not hitting the SWR revalidation.

That's the plan, at least! πŸ•

@bdougie
Copy link
Member

bdougie commented Aug 8, 2022

I was looking at this and saw the deploy preview currently returns the white screen of death.

@0-vortex
Copy link
Contributor Author

0-vortex commented Aug 8, 2022

I was looking at this and saw the deploy preview currently returns the white screen of death.

Oh yeah, I made the not logged in checks too lax and then focused on finishing the votes - made the upvote work sometime today but got left with an unstated "voted/upvote" button, will drop the fix for not logged in along with that, almost done with the hero repos. When that happens it won't be a draft anymore πŸ•

@NsdHSO NsdHSO mentioned this pull request Aug 8, 2022
2 tasks
@NsdHSO
Copy link
Contributor

NsdHSO commented Aug 8, 2022

Have you considered adding the preloader for PostList ?

@0-vortex
Copy link
Contributor Author

0-vortex commented Aug 8, 2022

Have you considered adding the preloader for PostList ?

Yes, however that one doesn't use SWR, a correct preload mechanism there is to animate itemsPerPage skeletons. With cached values, in the hero, we can display the repository name while the other data is loading, however because this data is static, this can be done right now; in the post wrap component we load about 30 at a time so we would need a local storage cache implemented in SWR to correctly display some data.

React loading skeleton package is a bit more useful than dropping a circle loading spinner, however it requires stateful data loading, something we get with API+SWR, right now using supabase js we would have to implement that manually.

Will check the best way to display at least one skeleton in the post list and alert the user on clicking load more. πŸ•

@0-vortex 0-vortex marked this pull request as ready for review August 9, 2022 02:01
Copy link
Member

@bdougie bdougie left a comment

Choose a reason for hiding this comment

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

LGTM

@bdougie
Copy link
Member

bdougie commented Aug 9, 2022

@open-sauced/triage take a look at this and confirm data renders

@0-vortex 0-vortex merged commit 6b5a06a into main Aug 9, 2022
@0-vortex 0-vortex deleted the 270-use-async-hooks-and-api branch August 9, 2022 23:00
github-actions bot pushed a commit that referenced this pull request Aug 9, 2022
## [2.22.0](v2.21.2...v2.22.0) (2022-08-09)

### πŸ• Features

* updated css to respect row in subnav ([#298](#298)) ([3211cf4](3211cf4)), closes [#221](#221)
* use async hooks and beta api for hot repos ([#296](#296)) ([6b5a06a](6b5a06a)), closes [#276](#276) [#272](#272) [#270](#270)
@github-actions
Copy link

github-actions bot commented Aug 9, 2022

πŸŽ‰ This PR is included in version 2.22.0 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

0-vortex added a commit that referenced this pull request Aug 11, 2022
* origin/main:
  chore(patch): release 2.23.3 [skip ci]
  fix: correct swr fetcher not throwing on error (#306)
  chore(patch): release 2.23.2 [skip ci]
  fix: load more doesn't load repositories (#304)
  chore(patch): release 2.23.1 [skip ci]
  fix: dedupe app global user state (#303)
  chore(minor): release 2.23.0 [skip ci]
  feat: change title font to open sans bold (#300)
  chore(minor): release 2.22.0 [skip ci]
  feat: updated css to respect row in subnav (#298)
  feat: use async hooks and beta api for hot repos (#296)
0-vortex added a commit that referenced this pull request Aug 11, 2022
* origin/main: (117 commits)
  chore(patch): release 2.23.3 [skip ci]
  fix: correct swr fetcher not throwing on error (#306)
  chore(patch): release 2.23.2 [skip ci]
  fix: load more doesn't load repositories (#304)
  chore(patch): release 2.23.1 [skip ci]
  fix: dedupe app global user state (#303)
  chore(minor): release 2.23.0 [skip ci]
  feat: change title font to open sans bold (#300)
  chore(minor): release 2.22.0 [skip ci]
  feat: updated css to respect row in subnav (#298)
  feat: use async hooks and beta api for hot repos (#296)
  chore(patch): release 2.21.2 [skip ci]
  fix(vite.config.ts): correct font loading preload (#294)
  chore(patch): release 2.21.1 [skip ci]
  fix: dedupe handleVoteUpdateByRepo function (#292)
  chore(minor): release 2.21.0 [skip ci]
  chore(minor): release 2.20.0 [skip ci]
  feat: make the contributors StackedAvatars component reusable (#290)
  chore(minor): release 2.19.0 [skip ci]
  feat: added system notification (#285)
  ...
@github-actions
Copy link

πŸŽ‰ This PR is included in version 2.24.0-beta.1 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

@github-actions
Copy link

πŸŽ‰ This PR is included in version 2.24.0 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

@bdougie bdougie mentioned this pull request Sep 9, 2022
2 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants