Skip to content

WEBDEV-9249: Add a language switch to the elements demo - #135

Open
jbuckner wants to merge 7 commits into
WEBDEV-9226-locale-datafrom
WEBDEV-9249-demo-language-switch
Open

jbuckner wants to merge 7 commits into
WEBDEV-9226-locale-datafrom
WEBDEV-9249-demo-language-switch

Conversation

@jbuckner

@jbuckner jbuckner commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Adds a demo-only EN/ES switch to the elements demo, with a ?lang=es deep link, so a reviewer can see elements rendered in Spanish from this PR's preview.

https://webarchive.jira.com/browse/WEBDEV-9249

🤖 Generated with Claude Code

https://claude.ai/code/session_013cDnU6cdXPyqhk2vxquGpk

jbuckner and others added 2 commits October 1, 2026 16:01
@jbuckner
jbuckner added this pull request to stack #136 October 1, 2026 23:06
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://internetarchive.github.io/elements/pr/pr-135/

Built to branch ghpages at 2026-10-02 20:58 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov-commenter

codecov-commenter commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (WEBDEV-9226-locale-data@37c9bfa). Learn more about missing BASE report.

Files with missing lines Patch % Lines
demo/app-root.ts 87.50% 2 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##             WEBDEV-9226-locale-data     #135   +/-   ##
==========================================================
  Coverage                           ?   91.46%           
==========================================================
  Files                              ?       62           
  Lines                              ?     2661           
  Branches                           ?      627           
==========================================================
  Hits                               ?     2434           
  Misses                             ?       79           
  Partials                           ?      148           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

jbuckner and others added 2 commits October 1, 2026 16:19
The "quick EN click after ES wins" test awaited Promise.all on two real
setLocale calls, but @lit/localize already serializes and drops stale
loads internally, and both calls were awaiting one shared Deferred — so
their continuations ran in call order regardless of _setLocale's own
request-id guard. The test passed even with that guard removed.

Stubs setLocale per-test so the ES and EN calls get independently
resolvable promises, letting the test deliver the EN reply before the
ES one despite ES being requested first. That's the only way the
request-id guard's check is actually exercised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lit/localize's own setLocale already serializes concurrent switches
and drops a stale load, so every caller's continuation runs in call
order regardless of which locale's module arrives first. The counter
added in the prior commit duplicated that guarantee; the stale-switch
bug it was chasing was actually the earlier "if (locale ===
this._locale) return" early exit, which skipped a newer request
whenever it matched the not-yet-updated this._locale. Removing that
early exit (now covered by a plain unconditional set after await) is
the fix; the existing "quick EN click after ES wins" test already
catches a regression of it.

Also:
- Warn instead of silently swallowing a rejected _setLocale call at
  both fire-and-forget call sites (the deep-link check and the click
  handler).
- Close an eslint guard gap: `@lit/localize/init/*` re-exports
  configureLocalization and configureTransformLocalization under
  paths the existing `@lit/localize` specifier check didn't cover, and
  configureTransformLocalization wasn't restricted at all.
- Share the customElement restricted-imports list between the two
  no-restricted-imports blocks instead of repeating it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jbuckner jbuckner closed this Oct 1, 2026
@jbuckner jbuckner reopened this Oct 1, 2026
jbuckner and others added 2 commits October 1, 2026 16:53
…witch

Reconciles the demo language switch with WEBDEV-9230's mobile bottom bar
and sheet picker plus the desktop sidebar's Hide nav toggle: the switch
sits in the content header next to the title on desktop, and in the
picker sheet header on a narrow viewport.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Loading <ia-button-story> is a lazy dynamic import, and a busy CI runner
can take more than the default 1-second waitUntil timeout to finish it.
Other waits on lazy-loaded story content in this file already carry a
5000ms timeout for the same reason; this one never got the same bump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013cDnU6cdXPyqhk2vxquGpk

* origin/WEBDEV-9256-fix-demo-ci-focused-view:
  WEBDEV-9256: Give the focused-story test room for a slow lazy import

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants