From dcc81c8b03ddb61c26641aad4e1f2e037f4a2572 Mon Sep 17 00:00:00 2001 From: keyan Date: Mon, 25 Mar 2024 20:46:51 -0500 Subject: [PATCH] disable ios pwa prompt for more than a single page in #953 --- pages/_app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pages/_app.js b/pages/_app.js index a998e41e..127cff72 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -76,6 +76,14 @@ export default function MyApp ({ Component, pageProps: { ...props } }) { } }, [router.asPath, props?.apollo]) + useEffect(() => { + // hack to disable ios pwa prompt for https://github.com/stackernews/stacker.news/issues/953 + // see https://github.com/chrisdancee/react-ios-pwa-prompt/blob/66e91c4f033b740cff42c3220cf13ebdf39e3078/src/index.js#L30 + if (router?.query?.disablePrompt) { + localStorage.setItem("iosPwaPrompt", JSON.stringify({ isiOS: false, visits: 0 })) + } + }, [router?.query?.disablePrompt]) + /* If we are on the client, we populate the apollo cache with the ssr data