#4688: Fix DNS record type state on Add record form#4991
Open
#4688: Fix DNS record type state on Add record form#4991
Conversation
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.
Ticket
Resolves #4688
Changes
recordTypeAlpine variable when the Add record form opens, when a record is successfully submitted, and when Cancel is clicked.Context for reviewers
After adding a record, clicking "Add record" again was opening the form with all the body fields visible, like a type had already been picked. The dropdown itself was rendering empty (the HTML had the empty option selected), but the rest of the form was still showing.
The cause:
recordTypelives in the page-level Alpinex-datascope, so it stuck around between submissions. When htmx swapped in the fresh form HTML, the dropdown reset to empty butrecordTypekept its old value (e.g."A"), sox-show="recordType"on the form body stayed true.The fix is to clear
recordTypein the same spots we already clearshowFormId— Add record click, submit-success, and Cancel — so the two pieces of state stay in sync.Since the bug is Alpine state behavior, the test asserts the template-level click handlers are present (same pattern as the existing tab-order tests). It can't drive the JS, but it guards the hooks so a future template edit can't silently regress this.
Setup
Note: You will need env vars setup for dns hosting. View cf instance glacier env vars and our Engineering Master doc.
dns_hostingwaffle flag is on and the domain used for testing is enrolled in dns hosting.Code Review Verification Steps
As the original developer, I have
Satisfied acceptance criteria and met development standards
Ensured code standards are met (Original Developer)
Validated user-facing changes (if applicable)
As a code reviewer, I have
Reviewed, tested, and left feedback about the changes
Validated user-facing changes as a developer
Note: Multiple code reviewers can share the checklists above, a second reviewer should not make a duplicate checklist. All checks should be checked before approving, even those labeled N/A.
As a designer reviewer, I have
Verified that the changes match the design intention
Validated user-facing changes as a designer
References
Screenshots