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
BB-764: On the unified form, ticking and then unticking the "Automatically add ISBN" checkbox results in the generated ISBN to be left over in the "edit identifiers" modal.
Unchecking should remove the auto-generated ISBN.
Solution
With the present code, what happens is that when the user checks the box for the first time, an action is dispatched to have the auto generated ISBN in the list of identifiers, but when he unchecks again, there was no direction to remove the added identifier. Hence, I have used this already defined removeIdentifierRow action:-
It requires rowId as a parameter, which we get using the addAutoIdentifier:-
After changes:-
https://github.com/metabrainz/bookbrainz-site/assets/116253210/ecfc1a2b-2f7e-45f0-817a-cc77243a27d9
Areas of Impact
src/client/unified-form/cover-tab/isbn-field.tsx
src/client/unified-form/interface/type.ts