Skip to content

web/i18n: Fix stale flow locale, unsynchronized locale selector options - #23007

Merged
GirlBossRush merged 2 commits into
mainfrom
fix-stale-flow-locale
Jun 16, 2026
Merged

GirlBossRush merged 2 commits into
mainfrom
fix-stale-flow-locale

Conversation

@GirlBossRush

@GirlBossRush GirlBossRush commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Details

This PR fixes two intertwined issues:

Unlocalized locale selector options

The locale selector is supposed to render each entry in the target language, and in the language you currently are viewing the page in.

The labels are now fixed and additional comments are added to clarify how this works.

Server-side localized labels

Server-side localized UI elements previously did not re-request the flow with the updated locale. This behavior was delayed to give us more confidence that the change wouldn't cause any issues in more complex flows.

After a few releases with the locale selector in production, we're ready to test this behavior and await any user feedback.

Closes #22954

@GirlBossRush GirlBossRush self-assigned this Jun 11, 2026
@GirlBossRush
GirlBossRush requested a review from a team as a code owner June 11, 2026 16:43
@GirlBossRush GirlBossRush added area:frontend Features or issues related to the browser, TypeScript, Node.js, etc i18n Internationalization and localization labels Jun 11, 2026
@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 7a7038c
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a2ae5971961a90008f1c9a0
😎 Deploy Preview https://deploy-preview-23007--authentik-integrations.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.

@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 7a7038c
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a2ae597d4e5d90008800f35
😎 Deploy Preview https://deploy-preview-23007--authentik-storybook.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.

@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 7a7038c
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a2ae5978eda120008898d70
😎 Deploy Preview https://deploy-preview-23007--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 Jun 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.23%. Comparing base (884904e) to head (7a7038c).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23007      +/-   ##
==========================================
- Coverage   93.25%   93.23%   -0.03%     
==========================================
  Files        1032     1032              
  Lines       60164    60186      +22     
  Branches      400      400              
==========================================
+ Hits        56108    56113       +5     
- Misses       4056     4073      +17     
Flag Coverage Δ
conformance 36.53% <ø> (-0.01%) ⬇️
e2e 41.78% <ø> (-0.04%) ⬇️
integration 32.48% <ø> (-0.50%) ⬇️
rust 0.00% <ø> (ø)
unit 92.20% <ø> (+<0.01%) ⬆️
unit-migrate 92.24% <ø> (+0.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.

@GirlBossRush GirlBossRush moved this from Todo to Needs review in authentik Core Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-7a7038c7acafcf1c52e9477276ae30ac4ba94a40
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-7a7038c7acafcf1c52e9477276ae30ac4ba94a40

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.

Solid.

@github-project-automation github-project-automation Bot moved this from Needs review to In Progress in authentik Core Jun 16, 2026
@GirlBossRush
GirlBossRush merged commit ee40107 into main Jun 16, 2026
112 checks passed
@GirlBossRush
GirlBossRush deleted the fix-stale-flow-locale branch June 16, 2026 23:48
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Jun 16, 2026
@GirlBossRush GirlBossRush added the backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5 label Jun 16, 2026
@authentik-automation

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.5 created: #23148

@authentik-automation

Copy link
Copy Markdown
Contributor

Cherry-pick to version-2026.5 already exists: #23148

GirlBossRush added a commit that referenced this pull request Jun 17, 2026
…ns (cherry-pick #23007 to version-2026.5) (#23148)

web/i18n: Fix stale flow locale, unsynchronized locale selector options (#23007)

* Track local event, refresh on change.

* Fix stale language selector value when switching between non-English entries.

Co-authored-by: Teffen Ellis <[email protected]>
BeryJu added a commit that referenced this pull request Jul 15, 2026
)

Back out the `LOCALE_STATUS_EVENT` listener that #23007 added to `FlowExecutor`. The label-formatting half of that PR (`format.ts`, `ak-locale-select.ts`, the `activeLocaleTag`-keyed `repeat`, and the mixin `@remarks`) stays; only the executor-side re-request goes.

The operator's report was that the flow executor isn't handling locale events well. Four failure modes make that report reproducible.

First, on mount we get two concurrent `flowsExecutorGet` calls. `firstUpdated` already kicks off `refresh()` unconditionally, and `LOCALE_STATUS_EVENT` fires as soon as `@lit/localize` resolves the initial locale, which on the cached/default path is the same tick. Both GETs land in the server's dispatch loop; each one calls `plan.next(self.request)` and writes back to `request.session[SESSION_KEY_PLAN]`. Django sessions aren't transactional across concurrent requests, so the second write can clobber the first.

Second, the promise chain in `firstUpdated` around line 253 breaks. `refresh().then(() => dispatchEvent(new AKFlowAdvanceEvent()))` resolves against the challenge *its* GET returned, but a second refresh can overwrite `this.challenge` in between, so listeners that read `flowExecutor.challenge` on advance see a stale stage.

Third, every user-initiated locale change destroys stage state. Once the executor is mounted, flipping the locale selector fires `LOCALE_STATUS_EVENT`, which calls `refresh()`, which replaces `this.challenge`. The `guard([challenge])` in the render tears down the whole stage subtree and rebuilds it, dropping typed input on password / email / identification stages and cancelling in-flight captcha and WebAuthn widgets.

Fourth, auto-advance stages (redirect, consent auto-confirm, source continuation) resolve on GET, so two concurrent GETs advance the plan twice and skip a stage.

`CaptchaStage` already shows the right pattern for this: the stage owns its own `LOCALE_STATUS_EVENT` listener and re-runs the locale-dependent piece in place, without tearing down its containing view. Whoever picks this up next should either re-render the server-rendered label subtrees in place, or fetch the label strings through a locale-aware endpoint, rather than re-requesting the whole flow.

Re-opens the server-side-label half of #22954.

Co-authored-by: Agent (authentik-m-web-flow-wide-brief-cherry) <[email protected]>
Co-authored-by: Jens L. <[email protected]>
BeryJu added a commit that referenced this pull request Jul 15, 2026
…rry-pick #24050 to version-2026.5) (#24068)

web/flow: revert locale-driven flow re-request from FlowExecutor (#24050)

Back out the `LOCALE_STATUS_EVENT` listener that #23007 added to `FlowExecutor`. The label-formatting half of that PR (`format.ts`, `ak-locale-select.ts`, the `activeLocaleTag`-keyed `repeat`, and the mixin `@remarks`) stays; only the executor-side re-request goes.

The operator's report was that the flow executor isn't handling locale events well. Four failure modes make that report reproducible.

First, on mount we get two concurrent `flowsExecutorGet` calls. `firstUpdated` already kicks off `refresh()` unconditionally, and `LOCALE_STATUS_EVENT` fires as soon as `@lit/localize` resolves the initial locale, which on the cached/default path is the same tick. Both GETs land in the server's dispatch loop; each one calls `plan.next(self.request)` and writes back to `request.session[SESSION_KEY_PLAN]`. Django sessions aren't transactional across concurrent requests, so the second write can clobber the first.

Second, the promise chain in `firstUpdated` around line 253 breaks. `refresh().then(() => dispatchEvent(new AKFlowAdvanceEvent()))` resolves against the challenge *its* GET returned, but a second refresh can overwrite `this.challenge` in between, so listeners that read `flowExecutor.challenge` on advance see a stale stage.

Third, every user-initiated locale change destroys stage state. Once the executor is mounted, flipping the locale selector fires `LOCALE_STATUS_EVENT`, which calls `refresh()`, which replaces `this.challenge`. The `guard([challenge])` in the render tears down the whole stage subtree and rebuilds it, dropping typed input on password / email / identification stages and cancelling in-flight captcha and WebAuthn widgets.

Fourth, auto-advance stages (redirect, consent auto-confirm, source continuation) resolve on GET, so two concurrent GETs advance the plan twice and skip a stage.

`CaptchaStage` already shows the right pattern for this: the stage owns its own `LOCALE_STATUS_EVENT` listener and re-runs the locale-dependent piece in place, without tearing down its containing view. Whoever picks this up next should either re-render the server-rendered label subtrees in place, or fetch the label strings through a locale-aware endpoint, rather than re-requesting the whole flow.

Re-opens the server-side-label half of #22954.

Co-authored-by: Teffen Ellis <[email protected]>
Co-authored-by: Agent (authentik-m-web-flow-wide-brief-cherry) <[email protected]>
Co-authored-by: Jens L. <[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.5 Add this label to PRs to backport changes to version-2026.5 i18n Internationalization and localization

Projects

Archived in project

2 participants