attempt to fix #81#92
Merged
Merged
Conversation
…ojects validatedInput and validatedServer were computed vars, causing 3 independent Combine chains and 2 network requests per debounce cycle. Converting them to lazy stored properties with .share() reduces this to 1 request. Also bumped password debounce from 0.5s to 1s and added .removeDuplicates() to the QR scanner publisher.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR attempts to reduce duplicate validation/scanning events that may contribute to excessive requests when adding projects manually or via QR code.
Changes:
- Debounces QR password validation for longer and removes a debug log.
- Suppresses duplicate scanned QR URLs.
- Shares manual validation publishers and limits server validation concurrency.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
PayForMe/Views/Projects/QRCodes/AddProjectQRViewModel.swift |
Adjusts QR/password validation event handling. |
PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift |
Refactors manual validation publishers to reduce duplicate requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…lViewModel Replace flatMap(maxPublishers: .max(1)) with map + switchToLatest() so that when a new project input arrives, the previous in-flight validation is abandoned and its result is never delivered downstream. Move lastProjectTestedSuccessfully assignment into handleEvents after switchToLatest so stale async completions cannot enable the Add button with outdated data. Agent-Logs-Url: https://github.com/InteractionEngineer/PayForMe/sessions/6439287b-270d-45c7-b76d-2544c0f0689c Co-authored-by: InteractionEngineer <56229275+InteractionEngineer@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
I tried working with debug logs and see where events do fire and what may cause too many events to fire but as I never had the problems myself, e.g mentioned in julien-nc/cospend-nc#258, and to date no one offered to help out with a setup that error can be reproduced with, it's a hopeful try. Until another occurence, this merge closes #81.