From f3c82606d49c22f9ec2744737e09e147ed055534 Mon Sep 17 00:00:00 2001 From: SakshiKekre Date: Thu, 23 Apr 2026 23:23:05 -0700 Subject: [PATCH 1/4] Respect multizone base path for icons and assets --- dashboard/next.config.mjs | 10 +++++++++- dashboard/src/app/layout.jsx | 9 +++++++-- dashboard/src/utils/basePath.js | 5 ++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/dashboard/next.config.mjs b/dashboard/next.config.mjs index 7b13f37..351f3d0 100644 --- a/dashboard/next.config.mjs +++ b/dashboard/next.config.mjs @@ -1,7 +1,15 @@ +const configuredBasePath = process.env.NEXT_PUBLIC_BASE_PATH; +const basePath = + configuredBasePath === '' ? undefined : configuredBasePath || '/us/taxsim'; +const publicBasePath = configuredBasePath === '' ? '' : basePath || ''; + /** @type {import('next').NextConfig} */ const nextConfig = { output: 'export', - basePath: '/us/taxsim', + ...(basePath ? { basePath } : {}), + env: { + NEXT_PUBLIC_BASE_PATH: publicBasePath, + }, images: { unoptimized: true, }, diff --git a/dashboard/src/app/layout.jsx b/dashboard/src/app/layout.jsx index e991e38..f83ec21 100644 --- a/dashboard/src/app/layout.jsx +++ b/dashboard/src/app/layout.jsx @@ -2,6 +2,11 @@ import './globals.css'; import Header from '@/components/Header'; const GA_ID = 'G-2YHG89FY0N'; +const BASE_PATH = + process.env.NEXT_PUBLIC_BASE_PATH !== undefined + ? process.env.NEXT_PUBLIC_BASE_PATH + : '/us/taxsim'; +const ICON_PATH = `${BASE_PATH || ''}/policyengine.png`; export const metadata = { title: 'PolicyEngine TAXSIM — The next chapter of TAXSIM', @@ -21,8 +26,8 @@ export const metadata = { 'The next chapter of TAXSIM. Open-source, drop-in compatible tax calculator powered by PolicyEngine.', }, icons: { - icon: '/policyengine.png', - apple: '/policyengine.png', + icon: ICON_PATH, + apple: ICON_PATH, }, alternates: { canonical: 'https://policyengine.org/us/taxsim', diff --git a/dashboard/src/utils/basePath.js b/dashboard/src/utils/basePath.js index 82661fc..5eb3a59 100644 --- a/dashboard/src/utils/basePath.js +++ b/dashboard/src/utils/basePath.js @@ -6,7 +6,10 @@ * to public data files (e.g. /data/2024/results.csv). */ -const BASE_PATH = '/us/taxsim'; +const BASE_PATH = + process.env.NEXT_PUBLIC_BASE_PATH !== undefined + ? process.env.NEXT_PUBLIC_BASE_PATH + : '/us/taxsim'; /** Prefix a public asset path (e.g. /data/2024/results.csv) */ export function assetUrl(path) { From 43e59a08fc2262571c25883d9f590308fe6150c6 Mon Sep 17 00:00:00 2001 From: SakshiKekre Date: Sat, 2 May 2026 17:36:03 -0700 Subject: [PATCH 2/4] Use Next.js icon file convention for favicon Move policyengine.png to app/icon.png and remove the metadata.icons block. Next.js auto-emits a basePath-prefixed with content hash and MIME type, replacing the manual BASE_PATH string concatenation that worked around Next.js #61487 (metadata.icons URLs not auto-prefixed). --- .../{public/policyengine.png => src/app/icon.png} | Bin dashboard/src/app/layout.jsx | 9 --------- 2 files changed, 9 deletions(-) rename dashboard/{public/policyengine.png => src/app/icon.png} (100%) diff --git a/dashboard/public/policyengine.png b/dashboard/src/app/icon.png similarity index 100% rename from dashboard/public/policyengine.png rename to dashboard/src/app/icon.png diff --git a/dashboard/src/app/layout.jsx b/dashboard/src/app/layout.jsx index f83ec21..b2797a5 100644 --- a/dashboard/src/app/layout.jsx +++ b/dashboard/src/app/layout.jsx @@ -2,11 +2,6 @@ import './globals.css'; import Header from '@/components/Header'; const GA_ID = 'G-2YHG89FY0N'; -const BASE_PATH = - process.env.NEXT_PUBLIC_BASE_PATH !== undefined - ? process.env.NEXT_PUBLIC_BASE_PATH - : '/us/taxsim'; -const ICON_PATH = `${BASE_PATH || ''}/policyengine.png`; export const metadata = { title: 'PolicyEngine TAXSIM — The next chapter of TAXSIM', @@ -25,10 +20,6 @@ export const metadata = { description: 'The next chapter of TAXSIM. Open-source, drop-in compatible tax calculator powered by PolicyEngine.', }, - icons: { - icon: ICON_PATH, - apple: ICON_PATH, - }, alternates: { canonical: 'https://policyengine.org/us/taxsim', }, From e92b400fc6aea5e9f815911a71bc2f5c37349320 Mon Sep 17 00:00:00 2001 From: SakshiKekre Date: Sat, 2 May 2026 17:38:02 -0700 Subject: [PATCH 3/4] Add changelog fragment --- changelog.d/fix-multizone-icon-basepath.changed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/fix-multizone-icon-basepath.changed.md diff --git a/changelog.d/fix-multizone-icon-basepath.changed.md b/changelog.d/fix-multizone-icon-basepath.changed.md new file mode 100644 index 0000000..29f9078 --- /dev/null +++ b/changelog.d/fix-multizone-icon-basepath.changed.md @@ -0,0 +1 @@ +Make TAXSIM base path configurable via NEXT_PUBLIC_BASE_PATH and use Next.js' icon file convention so the favicon resolves under the multizone basePath. From f1b06e4f23058d1539c8ccf9be365c1d5ae9d562 Mon Sep 17 00:00:00 2001 From: SakshiKekre Date: Thu, 7 May 2026 09:26:12 -0700 Subject: [PATCH 4/4] Revert env-driven basePath; keep literal /us/taxsim per Next.js docs The official Next.js multi-zones guide and with-zones example only show a literal basePath. The env-driven NEXT_PUBLIC_BASE_PATH override added earlier in this PR was a dev-ergonomics workaround that hides basePath bugs in dev and isn't supported by the docs. Drop it; the icon file convention change remains the only canonical fix in this PR. --- dashboard/next.config.mjs | 10 +--------- dashboard/src/utils/basePath.js | 5 +---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/dashboard/next.config.mjs b/dashboard/next.config.mjs index 351f3d0..7b13f37 100644 --- a/dashboard/next.config.mjs +++ b/dashboard/next.config.mjs @@ -1,15 +1,7 @@ -const configuredBasePath = process.env.NEXT_PUBLIC_BASE_PATH; -const basePath = - configuredBasePath === '' ? undefined : configuredBasePath || '/us/taxsim'; -const publicBasePath = configuredBasePath === '' ? '' : basePath || ''; - /** @type {import('next').NextConfig} */ const nextConfig = { output: 'export', - ...(basePath ? { basePath } : {}), - env: { - NEXT_PUBLIC_BASE_PATH: publicBasePath, - }, + basePath: '/us/taxsim', images: { unoptimized: true, }, diff --git a/dashboard/src/utils/basePath.js b/dashboard/src/utils/basePath.js index 5eb3a59..82661fc 100644 --- a/dashboard/src/utils/basePath.js +++ b/dashboard/src/utils/basePath.js @@ -6,10 +6,7 @@ * to public data files (e.g. /data/2024/results.csv). */ -const BASE_PATH = - process.env.NEXT_PUBLIC_BASE_PATH !== undefined - ? process.env.NEXT_PUBLIC_BASE_PATH - : '/us/taxsim'; +const BASE_PATH = '/us/taxsim'; /** Prefix a public asset path (e.g. /data/2024/results.csv) */ export function assetUrl(path) {