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 useContractReads state dumping #393

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

jordanlesich
Copy link
Collaborator

Description

Adds keepPreviousData : true to useContractReads to useVotes hook and ProposalActions

Motivation & context

wagmi useContractReads hook was forcing page re-renders due to a bug with state/caching persistence

wevm/wagmi#2878

Took a bit of digging, but I was able to find a parameter that would stop this from happening

keepPreviousData : true

This solves both issues:

  1. Proposal description and title being deleted on first login on network switch
  2. Vote modal closing and deleting vote reason data on vote page.

Code review

Type of change

  • Bug fix (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)

Checklist

  • I have done a self-review of my own code
  • Any new and existing tests pass locally with my changes
  • My changes generate no new warnings (lint warnings, console warnings, etc)

@vercel
Copy link

vercel bot commented Oct 22, 2023

@jordanlesich is attempting to deploy a commit to the Nouns Builder Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Oct 23, 2023

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

Name Status Preview Updated (UTC)
nouns-builder ✅ Ready (Inspect) Visit Preview Oct 23, 2023 2:11am
testnet-nouns-builder ✅ Ready (Inspect) Visit Preview Oct 23, 2023 2:11am

@isaaczaak isaaczaak self-requested a review October 23, 2023 03:09
Copy link
Collaborator

@isaaczaak isaaczaak left a comment

Choose a reason for hiding this comment

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

Screen.Recording.2023-10-23.at.2.10.58.pm.mov

just want to make sure that "Vote modal closing and deleting vote reason data on vote page." refers to the issue that i'm experiencing in the recording attached @jordanlesich

Copy link
Collaborator

@isaaczaak isaaczaak left a comment

Choose a reason for hiding this comment

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

Clarified that issue #2 that this PR is trying to solves for is related to only to when a user is voting on a proposal when connected to a different network.

@jordanlesich jordanlesich merged commit f570420 into ourzora:main Oct 23, 2023
2 of 3 checks passed
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.

3 participants