web/table: fetch on first render when already visible#22376
web/table: fetch on first render when already visible#22376GirlBossRush wants to merge 4 commits into
Conversation
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ 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 #22376 +/- ##
==========================================
+ Coverage 93.07% 93.08% +0.01%
==========================================
Files 1032 1032
Lines 60055 60055
Branches 400 400
==========================================
+ Hits 55895 55902 +7
+ Misses 4160 4153 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Tables inside `<ak-modal>` rendered empty until the user clicked the refresh button. The 2026.5 RC native-`<dialog>` migration taught `AKModal.updated()` to force `visible = true` on its slotted child, but `Table.firstUpdated()` was delegating to `#synchronizeRefreshSchedule()`, which only flushes a *previously deferred* refresh. With visibility forced on before the first update cycle, no deferred refresh was ever queued, so the synchronizer no-op'd and nothing fetched. Switch the first-update hook to call `fetch()` directly. `fetch()` already handles both states correctly: if the table is visible it issues the request immediately, and if it isn't it queues the deferred refresh that the synchronizer flushes when visibility flips on. Beyond the modal case this also covers any future caller that mounts a Table already-visible. Reproduced and verified against the user-library RAC endpoint launcher (the surface from the beta report). Added a Playwright e2e (`rac-launch-modal.test.ts`) that seeds a RAC provider + two endpoints via the API, opens the launcher, and asserts the endpoint rows appear without a manual refresh — fails on `main`, passes with this change. A 2026.5 backport will follow as a separate PR. Co-Authored-By: Agent (authentik-m-triage-rac-proper-shared-lilac) <279763771+playpen-agent@users.noreply.github.com>
0036a40 to
ba1cd93
Compare
`changeme` in the playpen-specific default for `AK_TEST_BOOTSTRAP_TOKEN` trips the spellcheck lint job. Add an inline `cspell:ignore` directive so the fallback can stay (CI sets the env var so the default is only used locally inside playpen sandboxes).
e1c6528 to
2ec1794
Compare
2ec1794 to
09a3360
Compare
| <ak-form-element-horizontal required name="protocol"> | ||
| ${AKLabel( | ||
|
|
||
| <ak-radio-input |
There was a problem hiding this comment.
ARIA fixes for the e2e test.
| includeScore: true, | ||
| shouldSort: true, | ||
| ignoreFieldNorm: true, | ||
| useExtendedSearch: true, |
There was a problem hiding this comment.
AFAICT this is a vestigial setting and not something we've intended to support in this context. Disabling it here because programmatically generated application names can include search control characters that prevent results from matching.
| // So we exclude self-presentation explicitly. | ||
| const control = context | ||
| .getByLabel(fieldName, { exact: true }) | ||
| .and(context.locator(':not([role="presentation"])')) |
There was a problem hiding this comment.
This feels like a hack.
| // latter only flushes a *previously deferred* refresh and would no-op | ||
| // when a parent (e.g. `AKModal`) has already forced `visible = true` | ||
| // before the first update cycle, leaving the table empty on open. | ||
| this.fetch(); |
There was a problem hiding this comment.
Not connectedCallback() ?
I'm surprised Lit doesn't whine about a render being scheduled from an updated() command. It usually does. You can work around it by microtasking the fetch, but this still doesn't feel like the place to do that.
Summary
Tables inside
<ak-modal>rendered empty until the user clicked the refresh button — surfaced by a beta tester on the 2026.5 RC against the RAC endpoint launcher in the user library.Root cause
The native-
<dialog>modal migration (#21336) taughtAKModal.updated()to forcevisible = trueon its slotted child.Table.firstUpdated()was delegating to#synchronizeRefreshSchedule(), which only flushes a previously deferred refresh. With visibility forced on before the first update cycle, no deferred refresh was ever queued — so the synchronizer no-op'd and nothing fetched.Fix
Call
fetch()directly fromTable.firstUpdated().fetch()already handles both states correctly:The change therefore also covers any future caller that mounts a
Tablealready-visible, not just the modal path.protected override firstUpdated(changedProperties: PropertyValues<this>): void { super.firstUpdated(changedProperties); - this.#synchronizeRefreshSchedule(); + this.fetch(); }Test plan
main, populates without a manual refresh with this change.web/test/browser/rac-launch-modal.test.ts— seeds a RAC provider + two endpoints via the API, opens the launcher modal, asserts the endpoint rows appear without any user interaction. Fails onmain, passes with this change.make lint-fixclean.Disclosure
Triaged and authored end-to-end by an agent running in a sandbox against
goauthentik/authentik@main. Reviewed and shipped by @GirlBossRush.