Skip to content

ref(ui): Extract pure normalizeUrlWithCustomerDomain, keep normalizeUrl wrapper#119371

Closed
ryan953 wants to merge 1 commit into
masterfrom
ryan953/normalizeurl-inject-customer-domain
Closed

ref(ui): Extract pure normalizeUrlWithCustomerDomain, keep normalizeUrl wrapper#119371
ryan953 wants to merge 1 commit into
masterfrom
ryan953/normalizeurl-inject-customer-domain

Conversation

@ryan953

@ryan953 ryan953 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Splits normalizeUrl into a pure core plus a thin wrapper, so the customer-domain lookup is decoupled from the global config store without churning every callsite.

  • normalizeUrlWithCustomerDomain(path, {customerDomain, force}) — pure. Takes the customer domain as an argument instead of reading ConfigStore, so it's trivially testable and reusable (e.g. normalizing for a domain other than the active one).
  • normalizeUrl(path, {forceCustomerDomain}) — unchanged public API. Now delegates to the pure function, injecting ConfigStore.get('customerDomain').

Why this shape

An earlier revision of this PR pushed ConfigStore.get('customerDomain') out to all ~240 callsites. That worked but was a huge, noisy diff. The wrapper keeps the ergonomic normalizeUrl(path) API every callsite already uses while still exposing a pure function for callers that want to supply the domain themselves.

Scope

Every existing callsite is unchanged. The diff is two files: the util and its spec. No behavior change — the wrapper reproduces the original force-or-active-domain gate exactly.

Verification

  • pnpm typecheck — green (0 errors), confirming all existing callsites still compile against the wrapper
  • ESLint clean, oxfmt applied
  • Spec passes (5 tests): wrapper behavior via ConfigStore + pure-function behavior (including that the pure fn ignores global config)

@ryan953 ryan953 requested review from a team as code owners July 9, 2026 23:10
@ryan953 ryan953 requested review from Lms24, chargome, logaretm, mydea and s1gr1d and removed request for a team July 9, 2026 23:10
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 9, 2026
Base automatically changed from worktree-normalizeurl-two-args to master July 9, 2026 23:15
@ryan953 ryan953 force-pushed the ryan953/normalizeurl-inject-customer-domain branch from f16a5e9 to 745f4c8 Compare July 9, 2026 23:24
@ryan953 ryan953 marked this pull request as draft July 9, 2026 23:25
…rl wrapper

Split normalizeUrl into a pure core and a thin wrapper:

- normalizeUrlWithCustomerDomain(path, {customerDomain, force}) is pure. It
  takes the customer domain as an argument instead of reading global config,
  making it easy to test and reuse for a domain other than the active one.
- normalizeUrl(path, {forceCustomerDomain}) keeps its exact public API and now
  delegates to the pure function, injecting ConfigStore.get('customerDomain').

Every existing callsite is unchanged. No behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ryan953 ryan953 force-pushed the ryan953/normalizeurl-inject-customer-domain branch from 745f4c8 to 95b3d8f Compare July 9, 2026 23:32
@ryan953 ryan953 changed the title ref(ui): Inject customerDomain into normalizeUrl instead of reading ConfigStore ref(ui): Extract pure normalizeUrlWithCustomerDomain, keep normalizeUrl wrapper Jul 9, 2026
@ryan953 ryan953 marked this pull request as ready for review July 9, 2026 23:36
@ryan953 ryan953 closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant