Repository navigation
web/elements: reload edit forms after cancel and on pk change - #26892
Conversation
A modal keeps its edit form mounted between openings. Closing it reset the form, which cleared the loaded instance but left it marked as loaded, so the next opening rendered as a new object. On a RADIUS provider that meant a revealed, freshly generated shared secret that would replace the real one on save. Reloading after a reset is not enough for tables, which reuse a row's form for whichever object later lands in that row. Drop the loaded instance when the pk changes too, otherwise the form shows one object's data and saves it to another. Closes: #26874
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26892 +/- ##
===========================================
+ Coverage 69.56% 92.43% +22.87%
===========================================
Files 1180 1180
Lines 78716 78716
Branches 4129 4129
===========================================
+ Hits 54759 72764 +18005
+ Misses 23891 5886 -18005
Partials 66 66
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Playwright e2eDownload this run's HTML report and traces, then open the report: gh run download 38427801351 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-reportInstallation instructionsInstructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-fb87e3d65c6a3c30085f5ea04634ba9d7dd288fa
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-fb87e3d65c6a3c30085f5ea04634ba9d7dd288faAfterwards, run the upgrade commands from the latest release notes. |
|
🍒 Cherry-pick to |
…-pick #26892 to version-2026.8) (#26895) web/elements: reload edit forms after cancel and on pk change (#26892) Co-authored-by: Dominic Roy <[email protected]>
Details
What does this PR change?
ModelFormnow loads its instance again afterreset(), and drops a loaded instance wheninstancePkchanges.Why is this change needed?
Pages that use
<ak-forms-modal>keep the slotted edit form mounted between openings. Closing the dialog without saving (Cancel, the close button, Escape) callsreset(), which cleared the loaded instance but left#loadedAtset, so the form never loaded again. The next opening rendered as if it were creating a new object.On a RADIUS provider this shows the shared secret field already revealed and filled with a new random 128-character value, as described in #26874. Saving at that point replaces the real secret. The same applies to every field with a fallback, such as the client networks default. Saving and then reopening was not affected, because the refresh after a save reloads the instance.
Every view page with a persistent edit modal had the same problem (proxy, LDAP, SAML, SCIM, RAC, WS-Fed, Google Workspace, and Entra providers; Kerberos, Plex, SAML, SCIM, and Telegram sources; application entitlements). So did tables that render one per row (certificates, schedules, tokens, MFA devices, user applications).
Tables also needed the second change. They render rows by position, so after a search, sort, or delete a row's form gets a different
instancePk, andModelFormnever reloaded on a pk change. Before this PR that showed an empty form. With only the reset fix, the form reloads the old object when the dialog closes and would then show that object's data under the new row's pk, and save it there. Dropping the loaded instance when the pk changes makes the next opening load the right object.How was this tested?
I ran a local instance from this branch and replayed the steps from the issue. Before the fix, the second opening of a RADIUS provider's edit form showed a revealed, newly generated secret. After it, three Cancel and Edit cycles each showed the stored secret, masked.
On the certificate list, I opened the edit form for the first row, cancelled, searched so a different certificate became the first row, and opened its edit form. On
mainthe form was empty. With only the reset change it showed the previous certificate's name. With this PR it shows the right certificate. Fetches stay lazy: nothing loads when the list renders, one fetch happens on opening, and one more on closing.I also ran the modals, users, groups, providers, and applications browser suites against the build, and they passed.
Linked issues
Closes #26874
Checklist
make all)make docs)