Fix library upload error messages and stale SVG key crash#32
Open
ImranFarhat01 wants to merge 1 commit into
Open
Fix library upload error messages and stale SVG key crash#32ImranFarhat01 wants to merge 1 commit into
ImranFarhat01 wants to merge 1 commit into
Conversation
Problem: - Any upload failure showed generic 'An Error Occured' message - uploadSuccess reducer discarded HTTP status code, storing only true/false - Re-uploading a library crashed with KeyError because save_libs globbed all SVGs in the output folder including leftovers from previous uploads, then failed to find them in the current upload's component_details dict Fix: - Reducer stores HTTP status code in uploadError field on failure - Component reads uploadError via useSelector - Specific messages shown for 400, 401, 403, 413, 500 status codes - Add uploadError to useEffect dependency array to satisfy eslint - Skip SVGs not present in component_details instead of raising KeyError
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
uploadSuccessreducer discarded the HTTP status code, storing only true/falseKeyErrorbecausesave_libsglobbed all SVGs in the output folder (including leftovers from previous uploads), then failed to find them in the current upload'scomponent_detailsdictFix
uploadErrorfield on failureuploadErrorviauseSelectoruploadErrortouseEffectdependency array to satisfy eslintcomponent_detailsinstead of raisingKeyErrorTesting
.lib+.dcmfiles as a non-admin user → "Upload Successful" shown, component renders correctly on canvas