Skip to content

web/elements: reload edit forms after cancel and on pk change - #26892

Merged
dominic-r merged 1 commit into
mainfrom
dominic/web-reload-model-form-after-cancel
Oct 13, 2026
Merged

dominic-r merged 1 commit into
mainfrom
dominic/web-reload-model-form-after-cancel

Conversation

@dominic-r

Copy link
Copy Markdown
Member

Details

What does this PR change?

ModelForm now loads its instance again after reset(), and drops a loaded instance when instancePk changes.

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) calls reset(), which cleared the loaded instance but left #loadedAt set, 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, and ModelForm never 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 main the 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

  • The project has been linted, built, and tested (make all)
  • The documentation has been updated and formatted (make docs)
  • I have read the AI usage policy.

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
@dominic-r
dominic-r requested a review from a team as a code owner October 13, 2026 16:06
@dominic-r dominic-r added area:frontend Features or issues related to the browser, TypeScript, Node.js, etc backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8 labels Oct 13, 2026
@dominic-r dominic-r self-assigned this Oct 13, 2026
@netlify

netlify Bot commented Oct 13, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit fb87e3d
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6ace571729b27dff0fe8a0ee
😎 Deploy Preview https://deploy-preview-26892--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.43%. Comparing base (1ae2051) to head (fb87e3d).
✅ All tests successful. No failed tests found.

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               
Flag Coverage Δ
conformance 32.61% <ø> (+0.33%) ⬆️
e2e 37.35% <ø> (?)
integration 28.96% <ø> (?)
rust 46.45% <ø> (ø)
unit 93.90% <ø> (+23.45%) ⬆️
unit-migrate 93.89% <ø> (+50.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Playwright e2e

Download 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-report

Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

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)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

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-fb87e3d65c6a3c30085f5ea04634ba9d7dd288fa

Afterwards, run the upgrade commands from the latest release notes.

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in authentik Core Oct 13, 2026
@dominic-r
dominic-r merged commit ef19dcd into main Oct 13, 2026
147 checks passed
@dominic-r
dominic-r deleted the dominic/web-reload-model-form-after-cancel branch October 13, 2026 17:46
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Oct 13, 2026
@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.8 created: #26895

dominic-r added a commit that referenced this pull request Oct 13, 2026
…-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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Features or issues related to the browser, TypeScript, Node.js, etc backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

RADIUS provider edit form shows a new random shared secret when reopened; saving replaces the real secret

2 participants