Fix #82 : Submission form remains open after successful feature submission - #83
Open
byaruhaf wants to merge 1 commit into
Open
Fix #82 : Submission form remains open after successful feature submission#83byaruhaf wants to merge 1 commit into
byaruhaf wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
CreateWishViewhad two separate.alert(isPresented:)modifiers attached to the same view one driven byalertModel.showAlertand another byshowConfirmationAlert. 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
.alert(isPresented:)modifiers with a single.alert(item:)driven by oneActiveAlertenum, so there's exactly one alert presentation attached to the view at any time.createActionCompletion()/closeAction()directly into the alert's owndismissButtonaction, so they only fire once SwiftUI has taken ownership of dismissing that alert — removing the need for theDispatchQueue.main.asyncworkaround.guard !viewModel.isButtonLoading) at the top ofsubmitAction()to prevent double-submission from rapid double clicks.AlertModelandpresentationModedependency.Testing