Skip to content

fix: show completed stack as Finished instead of Not started - #162

Open
franrolotti wants to merge 1 commit into
developmentfrom
fix/completed-stack-shows-not-started
Open

fix: show completed stack as Finished instead of Not started#162
franrolotti wants to merge 1 commit into
developmentfrom
fix/completed-stack-shows-not-started

Conversation

@franrolotti

@franrolotti franrolotti commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #160 (frontend mitigation).

Problem

When a stack completes successfully (all members deposited and claimed), the UI showed "Not started" and re-enabled the Start button.

The contract's circleState() has no terminal "completed" value: once the last member claims, _withdraw sets isActive = false, so a finished circle is neither decommissioned nor active and falls through to NotStarted. The frontend mapped NotStarted straight to pending-start (which drives the "Not started" label and the Start button) before the unreachable finished branch could run.

Fix

In getUserCircleStatus, split the NotStarted branch on effectiveCircleStartTime, which is only non-zero once the circle has actually been started. NotStarted with a start time set is a completed circle → return finished; otherwise it's genuinely pending start. This corrects the label and hides the Start button (gated on pending-start).

Scope / follow-up

This is a frontend-only mitigation and ships without a redeploy. We should do changes in the contracts as

  • circleState() needs a real terminal state for a completed circle.
  • start() only checks isActive, so it will still accept a restart of a completed circle if called directly.

When the last member claims, the contract sets isActive=false, and
circleState() has no terminal completed value, so a cleanly finished
circle falls through to NotStarted. The frontend mapped that to
'pending-start', showing 'Not started' and re-enabling the Start button.

Distinguish the two in getUserCircleStatus via effectiveCircleStartTime,
which is only non-zero once the circle has actually started: NotStarted
with a start time set means finished, not pending start.

Frontend-only mitigation. The underlying contract issue (circleState()
lacking a terminal state, and start() accepting a restart of a completed
circle) still needs a redeploy and is tracked separately.

Refs #160
@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy Preview for app-stacks ready!

Name Link
🔨 Latest commit fa12f4a
🔍 Latest deploy log https://app.netlify.com/projects/app-stacks/deploys/6a5f4efa07c68e00095d90d2
😎 Deploy Preview https://deploy-preview-162--app-stacks.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

Completed stack shows "Not started" and Start button is clickable again

1 participant