Skip to content

Replace window.reload with proper state refresh after funding #524

@0xdevcollins

Description

@0xdevcollins

Problem

After a successful pledge in `funding-modal.tsx`, the page does `window.location.reload()` to reflect the new funding state. This breaks the SPA experience, loses scroll position, and causes a jarring full-page refresh.

Current Code

// After successful pledge
window.location.reload();

Expected Behavior

  • Use React state management to refresh funding data after pledge
  • Invalidate relevant queries (e.g., campaign data, funding progress, backers list)
  • Show updated funding progress bar immediately
  • Maintain scroll position and UI state
  • Consider optimistic update: show new amount immediately, reconcile with server

Implementation

  • If using React Query / SWR: invalidate campaign and contributions queries
  • If using local state: re-fetch via `getCampaignOnChain()` and update sidebar
  • Add `onSuccess` callback prop to `FundingModal` to notify parent

Acceptance Criteria

  • No full page reload after pledge
  • Funding progress updates immediately
  • Backers list refreshes
  • Scroll position maintained

Priority

Low — Functional but poor UX.

Labels

crowdfunding, ui, ux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions