-
-
Notifications
You must be signed in to change notification settings - Fork 7
perf: add deferRender prop for viewport-based lazy highlighting #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add deferRender prop to component that defers syntax highlighting until
the code block enters the viewport. Inspired by streamdown's approach.
Uses Intersection Observer + debounce + requestIdleCallback:
- Starts observing 300px before viewport entry (configurable)
- Debounces to ensure element is still in view
- Renders during browser idle time for optimal performance
API:
- `deferRender={true}` - enable with defaults
- `deferRender={{ rootMargin: '500px', debounceDelay: 200 }}` - custom options
- Default is `false` (immediate rendering, no behavior change)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
Claude finished @AVGVSTVS96's task —— View job Code Review Complete ✅Reviewing PR #113 for code quality, best practices, and ensuring proper changeset/documentation. Todo List
Code Review Feedback🚨 Critical Issues1. Missing ChangesetThe changeset-bot correctly identified this PR needs a changeset. Since you're adding new API surface ( npx changeset
# Select react-shiki -> minor
# Description: "Add deferRender prop for viewport-based lazy highlighting"2. No Test Coverage for New FeatureThe new
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create hooks/use-deferred-render.ts with full implementation
- Use streamdown-style API returning { shouldRender, containerRef }
- Remove from utils.ts
- Clarify in docs that deferRender is component-only
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Export useDeferredRender from all entry points (index, web, core) - Add README section showing how to use useDeferredRender with the hook - Include example with custom options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>

No description provided.