diff --git a/packages/web/components/templates/PrimaryLayout.tsx b/packages/web/components/templates/PrimaryLayout.tsx index e1a6128d8..17757cacd 100644 --- a/packages/web/components/templates/PrimaryLayout.tsx +++ b/packages/web/components/templates/PrimaryLayout.tsx @@ -1,6 +1,12 @@ import { PageMetaData, PageMetaDataProps } from '../patterns/PageMetaData' import { Box } from '../elements/LayoutPrimitives' -import { ReactNode, MutableRefObject, useEffect, useContext, useState } from 'react' +import { + ReactNode, + MutableRefObject, + useEffect, + useContext, + useState, +} from 'react' import { PrimaryHeader } from './../patterns/PrimaryHeader' import { useGetViewerQuery } from '../../lib/networking/queries/useGetViewerQuery' import { navigationCommands } from '../../lib/keyboardShortcuts/navigationShortcuts' @@ -11,7 +17,6 @@ import { ConfirmationModal } from '../patterns/ConfirmationModal' import { KeyboardShortcutListModal } from './KeyboardShortcutListModal' import { logoutMutation } from '../../lib/networking/mutations/logoutMutation' - type PrimaryLayoutProps = { children: ReactNode pageTestId: string @@ -25,7 +30,8 @@ export function PrimaryLayout(props: PrimaryLayoutProps): JSX.Element { const { viewerData } = useGetViewerQuery() const router = useRouter() const [showLogoutConfirmation, setShowLogoutConfirmation] = useState(false) - const [showKeyboardCommandsModal, setShowKeyboardCommandsModal] = useState(false) + const [showKeyboardCommandsModal, setShowKeyboardCommandsModal] = + useState(false) useKeyboardShortcuts(navigationCommands(router)) diff --git a/packages/web/components/templates/article/Article.tsx b/packages/web/components/templates/article/Article.tsx index f5d3cd00b..eb88f59fc 100644 --- a/packages/web/components/templates/article/Article.tsx +++ b/packages/web/components/templates/article/Article.tsx @@ -63,10 +63,12 @@ export function Article(props: ArticleProps): JSX.Element { // Post message to webkit so apple app embeds get progress updates useEffect(() => { - window?.webkit?.messageHandlers.readingProgressUpdate?.postMessage({ - progress: debouncedReadingProgress, - }) - }, [debouncedReadingProgress]) + if (typeof window?.webkit != 'undefined') { + window.webkit.messageHandlers.readingProgressUpdate?.postMessage({ + progress: debouncedReadingProgress, + }) + } + }, [readingProgress, debouncedReadingProgress]) const setScrollWatchedElement = useScrollWatcher( (changeset: ScrollOffsetChangeset) => { diff --git a/packages/web/pages/app/[username]/[slug]/index.tsx b/packages/web/pages/app/[username]/[slug]/index.tsx index e08eb4c61..9d1693beb 100644 --- a/packages/web/pages/app/[username]/[slug]/index.tsx +++ b/packages/web/pages/app/[username]/[slug]/index.tsx @@ -69,6 +69,7 @@ function AppArticleEmbedContent(