Skip to content

Fix #82 : Submission form remains open after successful feature submission - #83

Open
byaruhaf wants to merge 1 commit into
wishkit:mainfrom
byaruhaf:main
Open

Fix #82 : Submission form remains open after successful feature submission#83
byaruhaf wants to merge 1 commit into
wishkit:mainfrom
byaruhaf:main

Conversation

@byaruhaf

Copy link
Copy Markdown

Problem

On macOS, after successfully submitting a new wish via CreateWishView, the success alert was never appearing. Users would tap Save and nothing visible would happen no confirmation, no window close even though the wish was successfully created on the backend.

Root cause

CreateWishView had two separate .alert(isPresented:) modifiers attached to the same view one driven by alertModel.showAlert and another by showConfirmationAlert. On macOS, two separate .alert(isPresented:) modifiers on the same view appear to conflict the success alert's content was built but never actually presented on screen.

Fix

  • Replaced both .alert(isPresented:) modifiers with a single .alert(item:) driven by one ActiveAlert enum, so there's exactly one alert presentation attached to the view at any time.
  • Moved createActionCompletion() / closeAction() directly into the alert's own dismissButton action, so they only fire once SwiftUI has taken ownership of dismissing that alert — removing the need for the DispatchQueue.main.async workaround.
  • Added a synchronous guard (guard !viewModel.isButtonLoading) at the top of submitAction() to prevent double-submission from rapid double clicks.
  • Removed the now-unused AlertModel and presentationMode dependency.

Testing

  • Verified single Save tap → success alert appears → tapping OK closes the sheet and refreshes the list.
  • Verified Cancel with unsaved text still shows the discard confirmation alert and behaves correctly.

…h creation

- Replaced both `.alert(isPresented:)` modifiers with a single
  `.alert(item:)` driven by one `ActiveAlert` enum, so there's exactly one
  alert presentation attached to the view at any time.
- Moved `createActionCompletion()` / `closeAction()` directly into the
  alert's own `dismissButton` action, so they only fire once SwiftUI has
  taken ownership of dismissing that alert — removing the need for the
  `DispatchQueue.main.async` workaround.
- Added a synchronous guard (`guard !viewModel.isButtonLoading`) at the top
  of `submitAction()` to prevent double-submission from rapid double-clicks.
- Removed the now-unused `AlertModel` and `presentationMode` dependency.
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