From 63e8c3ca33e6ea702c65571ebf25b81c6fd574de Mon Sep 17 00:00:00 2001 From: Adian Kozlica <105174725+AdianKozlica@users.noreply.github.com> Date: Fri, 15 May 2026 01:50:13 +0200 Subject: [PATCH] fix: polyfill Map.getOrInsertComputed for Waterfox (#3067) --- apps/web/src/routes/__root.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx index 1af631923..3bc952b36 100644 --- a/apps/web/src/routes/__root.tsx +++ b/apps/web/src/routes/__root.tsx @@ -44,6 +44,17 @@ const title = `${appName} — ${tagline}`; const description = "Reactive Resume is a free and open-source resume builder that simplifies the process of creating, updating, and sharing your resume."; +const mapGetOrInsertComputedPolyfill = ` + if (!Map.prototype.getOrInsertComputed) { + Map.prototype.getOrInsertComputed = function (key, callbackFn) { + if (this.has(key)) return this.get(key); + const value = callbackFn(key); + this.set(key, value); + return value; + }; + } +`; + export const Route = createRootRouteWithContext()({ shellComponent: RootDocument, head: () => { @@ -77,7 +88,10 @@ export const Route = createRootRouteWithContext()({ { property: "og:description", content: description }, { property: "og:url", content: appUrl }, ], - scripts: import.meta.env.PROD ? [{ children: pwaServiceWorkerRegistrationScript }] : [], + scripts: [ + { children: mapGetOrInsertComputedPolyfill }, + ...(import.meta.env.PROD ? [{ children: pwaServiceWorkerRegistrationScript }] : []), + ], }; }, beforeLoad: async () => {