Lazy Loading
TikTok-style sequential mounting from mukoko-weather. Only one section mounts at a time through a global FIFO queue, preventing OOM crashes on mobile devices.
Install from registry
Section titled “Install from registry”npx shadcn@latest add https://mzizi.dev/api/v1/ui/lazy-sectionnpx shadcn@latest add https://mzizi.dev/api/v1/ui/use-memory-pressureDemonstration
Section titled “Demonstration”How it works
Section titled “How it works”Memory Pressure
Section titled “Memory Pressure”Monitor JS heap usage and react to memory pressure. Chrome-only API with graceful no-op fallback on other browsers.
function App() { const { isUnderPressure, usedMB, totalMB, usagePercent } = useMemoryPressure(85)
if (isUnderPressure) { // Reduce quality, unmount heavy components return <LightweightDashboard /> }
return <FullDashboard />}LazySection props
Section titled “LazySection props”| Prop | Type | Default | Description |
|---|---|---|---|
section |
string |
– | Section name for logging (required) |
fallback? |
ReactNode |
pulse skeleton | Shown while queued |
priority? |
number |
0 |
Lower = mounts first |
unmountDistance? |
number |
1500 |
Pixels past viewport to unmount |
disabled? |
boolean |
false |
Bypass lazy loading |