İçeriğe atla
ÖzelliklerFiyatlandırmaİş OrtaklığıBlogYardımHakkımızdaİletişim
BaşlaGiriş Yap
Bloga Dön
industry2026-05-2411 dk okuma

Müşteri sipariş takipte her push'ta yeni tab açıyor — PWA notification focus-existing-tab bug (PR #639 IV F2)

Eskisehir Tepebasi nda 38 yaslarinda "Anadolu Doner" sahibi Volkan, 14 yillik doner ustasi, son 18 ay thMenu Pro tier. Customer Web Push (PR #309) feature sayesinde musteriler preparing → ready → served gecislerini phone push olarak aliyordu. Sali sabahi Google Reviews bildirimine bakti: **"⭐ 1 yildiz — Berfin K.: Yemek 5 yildiz. Ama o siparis takip uygulamasini kullanmayin, her bildirimde yeni tab aciyor. Aksam yemegi icin siparis verdim, 6 tab acildi, telefonum kasildi."** thMenu support a yazdi. Support iOS Safari + Android Chrome reproduce: Berfin /order/xyz tab a verdi siparisi; her push tap inde clients.openWindow yeni tab acildi; 6 push = 6 tab; iPhone Safari background tab heartbeat ler ile cidden kasildi. **Wrong theory**: push payload URL her seferinde farkli ?t= timestamp query param iceriyor (cache-bust). Bilincli design karari ama SW match logic pathname-only compare etmeli. **Right theory**: apps/web-menu/src/app/sw.ts notificationclick handler targetUrl = resolved.pathname + resolved.search + resolved.hash olarak built ediliyor (orn /order/xyz?t=1747840000). Sonra match compare: u.pathname === targetUrl → /order/xyz === /order/xyz?t=1747840000 → **FALSE** (pathname query icermez); client.url === targetUrl → full URL different timestamp → **FALSE**. Ikisi FALSE → openWindow yeni tab. **PR #639 batch IV F2** fix tek concept: pathname-only compare + full URL openWindow icin reserve. `let targetPath = resolved.pathname; let targetUrl = resolved.pathname + resolved.search + resolved.hash; for (const client of allClients) { const u = new URL(client.url); if (u.pathname === targetPath) return client.focus(); } return clients.openWindow(targetUrl);` Artik u.pathname (/order/xyz) ile targetPath (/order/xyz) dogru match olur. Mevcut tab fokuslanir. Query/hash farkliliklar match i bozmaz. **Web-admin SW unaffected** cunku farkli match shape: `if (client.url.includes("/dashboard")) { await client.focus(); await client.navigate(targetUrl); }` — substring check zaten query/hash icermeyen yapida match yapar + navigate full URL i re-set eder. Customer-facing SPA router push state SW navigate uzerinden degil postMessage uzerinden tetikleniyor; mimari karar dogru ama match logic broken. PR shipped, Volkan Berfin e Google Business reply ile direct response yazdi + drink ikrami. Berfin replied: "Duzelttiginiz icin tesekkurler." Bir hafta sonra Berfin tekrar siparis verdi — tek tab. Google review **5 yildiz** olarak guncellendi. Volkan Google Business avg yildizi 4.7 → 4.8. Berfin in yorumu yeni customers icin concrete confidence signal. Pattern: **PWA service worker notificationclick handler focus-existing-tab logic query string + hash i compare DISINDA tutmali; pathname-only compare; openWindow icin full URL reserve.** Implementation checklist: (1) targetPath + targetUrl ayri build; (2) match u.pathname === targetPath only; (3) openWindow(targetUrl) only when no match; (4) origin check oncesi resolved.origin === self.location.origin; (5) multi-tab support; (6) postMessage to focused client SPA router state animation smooth. Daniel Birmingham Curry Lane Digbeth Custard Factory version unda ayni 6-tab spiral 1-star review.

th

thMenu Ekibi

thmenu.com

Faydalı buldunuz mu? Paylaşın.