4218-uploads-not-displaying-on-parts-review-page clear stale files state when part form modals close#4224
Open
RemainingDelta wants to merge 1 commit into
Open
Conversation
…ate when part form modals close
wavehassman
requested changes
May 22, 2026
Contributor
wavehassman
left a comment
There was a problem hiding this comment.
Great job fixing the bug! I would just prefer it to be structured differently
| const [uploading, setUploading] = useState(false); | ||
| const { mutateAsync: uploadFile } = useUploadFile(); | ||
|
|
||
| useEffect(() => { |
Contributor
There was a problem hiding this comment.
Instead of a useEffect in both files, just wrap handleClose in a callback that also clears the state. Then update the onHide= call. It should look something like this:
const handleCloseAndReset = () => {
setFiles([]);
setSelectedPartIndex(undefined);
handleClose();
};
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.
Changes
Fixed a bug in
SubmissionFormModalandReviewFormModalwhere uploaded file names would not appear after form submission.NERFormModalresets the RHFfileIdsfield array on every close, but the parallel localfiles: File[]state was never cleared. On re-open, the length mismatch caused the file list to not render. Added auseEffectin both modals that resetsfiles(andselectedPartIndexinReviewFormModal) wheneveropenbecomesfalse.Test Cases
Projects-> Specific Project ->Part Review->New->New Submission) — file names appear in the listScreenshots
Before
Note: This sometimes happens, not always


A file is uploaded, but it doesn't show file name
After
A file is uploaded, but it always shows file name:


Closes #4218