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

(govern) feat: add possibility to reset all votes #139

Merged
merged 3 commits into from
Mar 3, 2025

Conversation

Tanya-atatakai
Copy link
Collaborator

@Tanya-atatakai Tanya-atatakai commented Dec 4, 2024

Proposed changes

Screenshot 2024-12-04 at 13 52 39

Fixes

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Copy link

vercel bot commented Dec 4, 2024

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

Name Status Preview Comments Updated (UTC)
bond ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 9:17am
govern ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 9:17am
launch ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 9:17am
operate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 9:17am
registry ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 9:17am

queryClient.removeQueries({
predicate: (query) =>
INVALIDATE_AFTER_UPDATE_KEYS.includes(
(query.queryKey[1] as Record<string, string>)?.scopeKey,
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is [1] here?

Copy link
Collaborator Author

@Tanya-atatakai Tanya-atatakai Mar 3, 2025

Choose a reason for hiding this comment

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

it's the object of the query that includes all keys (arguments, scopeKey, etc.) related to particular readContract
image

});

// Reset previously saved data so it's re-fetched automatically
queryClient.removeQueries({
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not "invalidateQueries"? do we not want to refetch it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if using invalidate, afair some related useEffects won't be recalculated because saved cache will remain and just replaces with refetched data, while I needed it like the whole page was reloaded without actual reloading
TanStack/query#3169

@Tanya-atatakai Tanya-atatakai merged commit 7b5acd6 into main Mar 3, 2025
8 checks passed
@Tanya-atatakai Tanya-atatakai deleted the tanya/votes-reset branch March 3, 2025 11:09
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.

4 participants