Skip to content

Instantly share code, notes, and snippets.

View cmorten's full-sized avatar

Craig Morten cmorten

View GitHub Profile
@cmorten
cmorten / DangerousHydrateOnView.tsx
Last active April 20, 2025 22:10
React Hydrate On View
import React, { useEffect, useRef, useState } from 'react';
export function HydrateOnView({ children }: { children: React.ReactNode }) {
const ref = useRef<HTMLElement>(null);
const [inView, setInView] = useState(false);
useEffect(() => {
if (!ref.current || inView) return;
const observer = new IntersectionObserver(([entry]) => {
@cmorten
cmorten / config.yml
Last active November 4, 2022 16:23
CircleCI VoiceOver PoC
version: 2.1
orbs:
macos: circleci/[email protected]
jobs:
voiceover-test:
macos:
xcode: 12.5.1
steps:
@cmorten
cmorten / README.md
Last active January 24, 2021 00:07
Rollup Browser Dist - "Uncaught TypeError: Cannot read property 'split' of undefined"

Steps to reproduce

This instructions are for reproducing in Deno. Please note that the same code snippet will also reproduce the issue in any modern browser which supports ESM, namely via <script type="module">.

  1. Install Deno following the installation instructions for your platform;

  2. Execute deno run https://gist.githubusercontent.com/cmorten/fdffbd9ce521b6436f5fcbce429e752d/raw/d20036022c30ea8011def64a741aa82155c2afff/mod.ts to run the mod.ts code in this gist.

  3. Observe that the rollup browser distribution throws the error:

error: Uncaught TypeError: Cannot read property 'split' of undefined