Skip to content

Fix/safari request idle callback#8976

Closed
rbshh wants to merge 3 commits into
makeplane:previewfrom
rbshh:fix/safari-request-idle-callback
Closed

Fix/safari request idle callback#8976
rbshh wants to merge 3 commits into
makeplane:previewfrom
rbshh:fix/safari-request-idle-callback

Conversation

@rbshh
Copy link
Copy Markdown
Contributor

@rbshh rbshh commented Apr 29, 2026

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • Refactor
    • Improved idle callback scheduling mechanism for enhanced browser compatibility and performance optimization across rendering components.
    • Enhanced polyfill initialization to ensure proper setup during application startup.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: db478eda-8dc2-4e60-b704-4184c04cf281

📥 Commits

Reviewing files that changed from the base of the PR and between a62fe8a and 1114484.

📒 Files selected for processing (3)
  • apps/web/app/entry.client.tsx
  • apps/web/core/components/core/render-if-visible-HOC.tsx
  • apps/web/core/lib/polyfills/index.ts

📝 Walkthrough

Walkthrough

The pull request introduces polyfill support for request-idle and cancel-idle callbacks. An entry point imports the polyfill module at startup, a new scheduleIdleCallback API abstracts direct window.requestIdleCallback access, and an existing component is updated to use this abstraction instead of calling the browser API directly.

Changes

Cohort / File(s) Summary
Polyfill Infrastructure
apps/web/core/lib/polyfills/index.ts
Introduced scheduleIdleCallback function that ensures polyfills are installed and delegates to window.requestIdleCallback in browsers while returning 0 during SSR. Replaces previous side-effect-only implementation with an explicit API.
Polyfill Initialization & Component Updates
apps/web/app/entry.client.tsx, apps/web/core/components/core/render-if-visible-HOC.tsx
Entry point now imports polyfills at module initialization. Component refactored to use scheduleIdleCallback instead of direct window.requestIdleCallback calls, with cleanup logic updated to call observer.disconnect() and visibility effects re-running on useIdletime changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A polyfill's whisper, soft and slow,
Schedules idle moments as we go,
Callbacks tucked in fuzzy paws,
No more direct browser calls—
Just abstraction, smooth and clean! 🌿

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@rbshh rbshh marked this pull request as draft April 29, 2026 21:53
@rbshh rbshh closed this Apr 29, 2026
@rbshh rbshh deleted the fix/safari-request-idle-callback branch April 29, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant