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

Profile server client refresh #420

Merged
merged 16 commits into from
Apr 4, 2025
Merged

Conversation

bitbeckers
Copy link
Contributor

@bitbeckers bitbeckers commented Feb 7, 2025

Refactors the data fetching of the hypercert profile tabs to user server side APIs. Also implements a path invalidation flow that clears cached calls when a fraction claim was succesfully executed

@bitbeckers bitbeckers added the bug Something isn't working label Feb 7, 2025
@bitbeckers bitbeckers requested a review from Jipperism February 7, 2025 15:43
@bitbeckers bitbeckers self-assigned this Feb 7, 2025
Copy link

vercel bot commented Feb 7, 2025

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

Name Status Preview Comments Updated (UTC)
hypercerts-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2025 8:28am

This was referenced Feb 7, 2025
Base automatically changed from feat/batch-claim-fraction to dev February 7, 2025 18:10
@bitbeckers bitbeckers changed the title WIP: profile server client refresh Profile server client refresh Feb 10, 2025
@bitbeckers bitbeckers marked this pull request as ready for review February 10, 2025 09:28
Copy link
Contributor

@Jipperism Jipperism left a comment

Choose a reason for hiding this comment

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

I'm struggling a bit to come to grips with how all of this works. I understand we're polling from the client side now, but I'm not sure how the api routes get invalidated as they will be caching results as well. Calling revalidateServerPath("profile/[address]") will invalidate the cached data for all server components. I take it that it will invalidate all api's under that "profile/address" path as well? Because that data is now not server-component bound anymore but being fetched using react-query.

Another question: how does this data get invalidated if the user closes their window before the transaction completes? Are we then stuck with stale data until the next invalidation due to interaction (or vercel deploy)?

Refactors and optimises the data fetching of the tabs pages to speed up
the loading of the data
typo in filename, console logs, redundant business logic
Replace useQuery implementation in hypercerts-tab-content and -counts
component with hooks for reusability
Removes unused hooks and services from the hypercerts folder
Updates the refreshData methods in the unclaimed hypercerts claim and
batch claim button to:

- invalidate the user's profile page
- invalidate the relevant API paths
- all hypercert view pages for the claimed fractions hypercert IDs
- Refactors the refactor into server side data fetching, aiming for as
much SSR as possible
- Moves actions for hypercerts and allowlist into `actions` folder to
make their purpose explicit
- Removes the suspense boundary on the hypercerts-tab-content component
and puts it on the highest level possible - the UnclaimedFractions table
- Adds allowlist action for fetching unclaimed fractions with metadata
attached
- removes the delete action from the metadata fetcher. The requestmap is
ephemeral so we let is run with the lifecycle of the method
…uttons

- Refactors the refreshData method to improve path invalidation and refresh logic.
- Implements a 5-second delay before refreshing the router and navigating to the hypercerts-claimable tab.
- includes {path: "/", type: "layout"} to revalidate root layout.
- Deletes the useClaimableHypercerts, useCreatedHypercerts, and useOwnedHypercerts hooks as they are no longer needed.
- remove type for specific path
- add `/profile/${address}` for invalidation path because /page/[address] also seems have cache
Copy link
Contributor

@Jipperism Jipperism left a comment

Choose a reason for hiding this comment

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

@tnkshuuhei just had a look and seems to work well now. I think we can merge this. Would you want me to do that or do you want to do the honors?

@tnkshuuhei tnkshuuhei merged commit c67223e into dev Apr 4, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Hypercerts dev team daily ops Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants