Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: add requestIdleCallback polyfill at app entry for iOS WebKit (Fixes #9231) #9358
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
base: preview
Are you sure you want to change the base?
fix: add requestIdleCallback polyfill at app entry for iOS WebKit (Fixes #9231) #9358
Changes from all commits
786d537File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Duplicated polyfill logic + loose typing (
any).This block is copy-pasted verbatim across
apps/admin,apps/space, andapps/webentry files, and duplicates the already-existinginstallIdleCallbackPolyfillinapps/web/core/lib/idle-task.ts. Three independent copies of the same fallback logic will drift over time (e.g., one useswindow, the otherglobalThis; timeout/timeRemaining constants could diverge). Also,cb: anyandid: anyviolate the repo's strict-typing guideline.Consider extracting this into a shared, typed polyfill module (e.g. a
workspace:*package) and importing it from all three entry points, reusing theIdleRequestCallback/IdleRequestOptionstypes already established inapps/web/core/lib/idle-task.ts.♻️ Suggested typed version
As per coding guidelines,
**/*.{ts,tsx}: "TypeScript strict mode enabled; all files must be typed."📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Coding guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fallback ignores the
options.timeoutparam.Native
requestIdleCallbackaccepts(callback, options); this fallback only acceptscb, so any caller passing{ timeout: N }silently loses that hint and always fires after 1ms. This diverges from the sibling implementation inapps/web/core/lib/idle-task.ts, which honorsoptions?.timeout.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Duplicated polyfill; consider a shared utility and stricter typing.
This same block is copy-pasted verbatim across admin/space/web entry files, and
apps/web/core/lib/idle-task.tsalready implements an equivalentinstallIdleCallbackPolyfill(withoptions.timeoutsupport). Extracting a single shared implementation (e.g., a workspace package) avoids drift between the three copies and reuses the existing, more complete implementation. Also,cb: any/id: any/as anybypass strict typing — useIdleRequestCallback/IdleRequestOptions/numberinstead.♻️ Suggested typed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Coding guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Same
any-typing / droppedoptions.timeoutconcerns as the space app entry.cb: any/id: any/as anybypass strict typing, and the fallback signature drops theoptionsparameter that nativerequestIdleCallbacksupports, silently overriding any requested timeout with a hardcoded 1ms delay.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Redundant with existing
installIdleCallbackPolyfill; prefer reusing it.apps/web/core/lib/idle-task.tsalready exportsinstallIdleCallbackPolyfill, invoked viaapps/web/core/lib/polyfills/index.tson import, and it already supportsoptions.timeoutviarequestIdleFallback. Adding a second, slightly different inline implementation here (usingwindowinstead ofglobalThis, droppingoptions, and typed withany) creates two competing polyfill paths in the same app. Prefer importing and calling the existing installer instead of duplicating the logic.♻️ Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents