From e3583465b99bc46fabd3fb7bf75171651ae45179 Mon Sep 17 00:00:00 2001 From: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:35:36 +0000 Subject: [PATCH] Examples: Remove polyfill.io example (#875) Removes polyfill.io example. We don't recommend it Next.js in general. See: https://github.com/vercel/next.js/blob/bbf6dfac615ae50b1db87a02a1179a2808ba0746/errors/no-unwanted-polyfillio.mdx --- .../pages/index.tsx | 14 ----- .../pages/polyfill.tsx | 57 ------------------- 2 files changed, 71 deletions(-) delete mode 100644 solutions/script-component-strategies/pages/polyfill.tsx diff --git a/solutions/script-component-strategies/pages/index.tsx b/solutions/script-component-strategies/pages/index.tsx index cfc07c271..058aba2b7 100644 --- a/solutions/script-component-strategies/pages/index.tsx +++ b/solutions/script-component-strategies/pages/index.tsx @@ -59,20 +59,6 @@ function Home() {
-
- beforeInteractive examples - -
  • - Polyfill: Demo -{' '} - - Code - -
  • -
    -
    - -
    -
    afterInteractive examples diff --git a/solutions/script-component-strategies/pages/polyfill.tsx b/solutions/script-component-strategies/pages/polyfill.tsx deleted file mode 100644 index c2c248645..000000000 --- a/solutions/script-component-strategies/pages/polyfill.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { useEffect, useRef, useState } from 'react' -import Script from 'next/script' -import { Layout, Page, Text } from '@vercel/examples-ui' - -function Polyfill() { - const ref = useRef(null) - const [lastIntersection, setIntersection] = useState(new Date()) - - useEffect(() => { - const observer = new IntersectionObserver( - (intersections) => { - const isIntersecting = intersections[0]?.isIntersecting - - if (isIntersecting) { - setIntersection(new Date()) - } - }, - { - rootMargin: '45px', - } - ) - - if (ref.current) { - observer.observe(ref.current) - } - - return () => observer.disconnect() - }, []) - - return ( - <> - {/* We ensure that intersection observer is available by polyfilling it */} -