Skip to content

feat(fe): keep publications list and stats in sync via layout WebSocket and query tuning#37

Merged
SiegfriedBz merged 8 commits into
developfrom
feature/improve-publications-realtime-wss-stats
Apr 26, 2026
Merged

feat(fe): keep publications list and stats in sync via layout WebSocket and query tuning#37
SiegfriedBz merged 8 commits into
developfrom
feature/improve-publications-realtime-wss-stats

Conversation

@SiegfriedBz

Copy link
Copy Markdown
Owner

Summary

Fixes stale UI on /publications when users navigate between submit, list, and detail views, and when another wallet submits or status changes on-chain. Global metric cards now refresh together with the table.

 Problem

  • NewPublicationStatus subscriptions lived only on the list table, so leaving /publications dropped the WebSocket and missed events (e.g. submit redirect, spectator on detail).
  • The publications list query inherited a 60s global staleTime, so returning to the list could show cached rows/status without refetching.
  • WebSocket invalidation targeted publications only; useGlobalStats (statsKeys.all) never refetched, so cards stayed stale while the table updated.
  • Detail polling was every 5s; with WSS driving status more often, 10s is enough for assigned reviewer events that do not emit NewPublicationStatus.

 Solution

  • Add PublicationsRealtimeProvider and wrap the publications layout so useWatchNewPublicationStatusEvent runs for all /publications/* routes.
  • Remove the duplicate hook from `publications-table-container``.
  • Set staleTime: 0 on usePublications so the list background-refetches on mount.
  • On debounced NewPublicationStatus logs, invalidateQueries for publicationsKeys.all and statsKeys.all.
  • Bump usePublicationDetail refetchInterval from 5s to 10s while non-terminal.
  • Update READMEs accordingly.

v0.4.0: FrontEnd polish, Foundry CI & Monorepo docs
Merge `develop` into `main`
Merge Develop into main

## Summary
- Introduce standalone viem `PublicClient` instances with dedicated WebSocket
  (WSS) transports, independent of wagmi's wallet state, so event subscriptions
  are active for all page visitors — even without a connected wallet.
- Added `useWatchNewPublicationStatusEvent` to use viem's `watchContractEvent`
  directly instead of wagmi's `useWatchContractEvent`, which only initializes
  chain clients when a wallet is connected to that specific chain.
- Simplify the wagmi config to HTTP-only transports, since wallet-connected
  operations (transactions, signatures) don't need WebSocket.
- Introduce a `byQueryParams` query-key factory so the publications cache is
  scoped per page and filter combination.
- Debounce cache invalidation (3 s trailing window) to coalesce rapid-fire
  status transitions and account for CQRS eventual consistency.
Merge Develop into Main

refactor: simplify submit publication (fixed stake, derived fee)

## Summary

### Contract
- Simplify submitPublication by removing the _paidSubmissionFee parameter and deriving paidFee from msg.value - I_PUBLISHER_STAKE.
- Replace previous fee/stake validation with a single minimum-payment check: msg.value >= I_PUBLISHER_STAKE + I_PUBLISHER_MIN_FEE.
- Update all Foundry tests and helpers for the new function signature and revert behavior.

### Front End
- Simplify the frontend submission UX by removing the user stake input entirely and turning the fee box into a read-only breakdown (fixed stake + estimated fee + total).
- Regenerate the TS contract config to sync the ABI change.

### Deployments
- [Base Sepolia](https://sepolia.basescan.org/address/0xf569d7b5016de6ef0f16fcae82d85d61249df31d#code)
- [Ethereum Sepolia](https://sepolia.etherscan.io/address/0xfce6990d551a60f8640a498b6bc34a15822ba3e3#code)
Merge Develop into Main

chore(docs): update READMEs
@vercel

vercel Bot commented Apr 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bio-verify-ai-dapp Ready Ready Preview, Comment Apr 26, 2026 1:09pm

@SiegfriedBz
SiegfriedBz merged commit 2d2ea42 into develop Apr 26, 2026
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.

1 participant