Skip to content

Fix CashFlowForecast infinite re-render risk and wrong auth token key #542

Description

@Wilfred007

What

CashFlowForecast.tsx triggers an error toast on mount because distributionAccount is empty. Also, the service reads from localStorage.getItem('accessToken') but auth stores the token as payd_auth_token. All API calls send empty bearer tokens.

Why

The page is broken: immediate error on load, and all API calls fail with 401 because the auth token is read from the wrong key.

Scope

In scope: Fix auth token key, handle empty params gracefully, fix useCallback dependencies
Out of scope: Page redesign

Acceptance Criteria

  • No error toast on initial page load
  • Auth token read from correct localStorage key
  • API calls include valid bearer token
  • No infinite re-render risk

Technical Context

  • frontend/src/pages/CashFlowForecast.tsx lines 46-79 — issues
  • frontend/src/services/cashFlowForecastApi.ts lines 108, 149, 189, 230 — wrong key
  • Auth stores token as payd_auth_token per utils/api.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignfrontendFrontend developmentmediumModerate tasks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions