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

Add blockTag to observerId to avoid id collisions #2019

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Conversation

youPickItUp
Copy link
Contributor

@youPickItUp youPickItUp commented Mar 26, 2024

While using wagmi I notice that both of my useWatchBlocks hooks provide latest blocks even though one was suppose to subscribe to finalized blocks.

  useWatchBlocks({
    blockTag: 'latest',
    emitOnBegin: true,
    onBlock(block) {
      console.log('latest', { block })
    },
  });

  useWatchBlocks({
    blockTag: 'finalized',
    emitOnBegin: true,
    onBlock(block) {
      console.log('finalized', { block })
    },
  });

It seems there is observerId collision. Fix includes blockTag in the observerId to make it unique.


PR-Codex overview

This PR focuses on adding blockTag to observerId in watchBlocks to prevent id collisions.

Detailed summary

  • Added blockTag parameter to watchBlocks function
  • Updated observerId to include blockTag to avoid id collisions

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Mar 26, 2024

🦋 Changeset detected

Latest commit: fa39e03

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Mar 26, 2024

@youPickItUp is attempting to deploy a commit to the wevm Team on Vercel.

A member of the Team first needs to authorize it.

@jxom
Copy link
Member

jxom commented Mar 26, 2024

Legend

@jxom jxom merged commit 81ddc5e into wevm:main Mar 26, 2024
4 of 20 checks passed
@tmm tmm mentioned this pull request Mar 30, 2024
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.

2 participants