Skip to content

bug: auto-withdraw settings save uses a stale closure and can silently revert user changes #276

Description

@Austinaminu2

Problem

`addWithdrawalHistory` (`hooks/use-auto-withdraw.ts`, lines 79-92) updates React state via a functional updater, but calls `saveSettings(stream.id, {...settings, ...})` using the stale closed-over `settings` (lines 86-89) instead of the updated value.

Location

`hooks/use-auto-withdraw.ts:79-92`

Impact

A settings change made between renders can be silently reverted in localStorage when a withdrawal history entry is added shortly after, with no indication anything went wrong.

Suggested fix

Persist settings via the latest value (e.g. a ref updated alongside state, or restructure so save always reads current state) rather than a stale closure.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingfrontendNext.js frontend

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions