Repository navigation
Keep the chosen folder showing in the form's Folder dropdown - #562
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.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.
Closes #537
Problem
On a form's edit page, picking a folder from the Folder dropdown saved it, but the dropdown snapped back to the old folder, so it looked as if nothing had happened (confusing, as the reporter notes, with many folders).
Cause
The dropdown's value came only from the
currentFolderIdprop, which is the folder the form had when the page loaded.FormPlaygrounddoesn't pass anonUpdateback to it, so after a change the prop never changed and React reset the select to the old value, even though the change had been saved.Fix
FormFolderSelectorkeeps its own selected folder: set immediately when you choose (including "No folder" and a newly created folder), still follows the prop if the page does pass a new one, and put back to the previous folder with an error message if the save fails (rather than showing a folder that wasn't saved).Testing
FormFolderSelector.test.tsx(6 tests): shows the form's folder; keeps the chosen folder when the parent never passes it back; No folder; reverts with a message if saving fails; follows a changed prop; a new folder gets selected. 4 of them fail against the old component. Typecheck (apart from the existinggetJsonSchema.test.tserrors), lint and the full suite pass. Not yet checked in a browser.🤖 Generated with Claude Code