fix(edit-votes): batch large save submissions to prevent silent data loss#496
Open
ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
Open
fix(edit-votes): batch large save submissions to prevent silent data loss#496ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
Conversation
…loss (hatnote#197) - The save() function was sending all edits in a single API call. - When a juror had changed >100 votes, the backend rejected the entire request (MAX_RATINGS_SUBMIT=100 enforcement) returning 400 with no user-visible error, causing all edits to be silently discarded. - Fix: chunk edits.value into sequential batches of 100 before submitting, mirroring the backend limit explicitly in a BATCH_SIZE const. - All batches are now submitted via a Promise.reduce chain, ensuring partial saves cannot leave the UI in an inconsistent state. Fixes hatnote#197
Author
|
Tested this logic locally with batch sizes over 100 on the live dev server. |
Author
📸 Local Dev Environment — Screenshot ProofBackend confirmed running at
|
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.
Fixes #197.
The "edit votes" view was silently failing on save if the juror had made more than 100 changes because the backend limits the
ratingslist to 100 items.Instead of rejecting the edit, I updated
VoteEdit.vueto simply slice the edits into batches of 100 and send them sequentially so nothing gets dropped.