perf(canvas-renderer): remove requestAnimationFrame polyfill/compat#2238
Merged
Conversation
This served unsupported browsers (IE 9 days and old JSDOM).
There was a problem hiding this comment.
Pull Request Overview
This PR removes legacy requestAnimationFrame polyfills from the CanvasRenderer module and introduces a basic polyfill in the test setup to support JSDOM environments.
- Remove internal rAF/timeout compatibility code from
CanvasRenderer.js - Add temporary
requestAnimationFrame/cancelAnimationFramepolyfill in tests - Clean up related timer properties and logic
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/canvas-mock.js | Add basic rAF polyfill for JSDOM and note a TODO for a better solution |
| lib/network/modules/CanvasRenderer.js | Strip out old timeout/rAF compatibility code and simplify rendering logic |
Comments suppressed due to low confidence (3)
test/canvas-mock.js:158
- [nitpick] The inline TODO is vague; consider creating a tracking issue for this enhancement and referencing its ID here, or remove the TODO once the solution is finalized.
// TODO: JSDOM doesn't polyfill this. Find a better solution, maybe switch to
lib/network/modules/CanvasRenderer.js:16
- [nitpick] The property name
requestAnimationFrameRequestIdis quite long; consider renaming it to a more concise identifier likeframeRequestIdoranimationFrameIdfor readability.
this.requestAnimationFrameRequestId = undefined;
lib/network/modules/CanvasRenderer.js:102
- Consider adding unit tests for the new requestAnimationFrame-based rendering flow, covering
_startRendering,_renderStepscheduling, and cancellation in the destroy handler.
_startRendering() {
Collaborator
|
🎉 This PR is included in version 9.1.13 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This served unsupported browsers (IE 9 era, no longer supported) and our test setup without proper polyfills for necessary browser APIs.
I mostly need to remove this because without it I can't merge all of the updates that are still pending across Vis.js repos. With updated dependencies it fails on maximum call stack size exceeded. Though it also cuts down on bundle size and reduces overhead.