Skip to content

Conversation

normanrz
Copy link
Member

Adds a polyfill for iterator-helpers, because some people haven't upgraded their browsers yet.

@normanrz normanrz requested a review from hotzenklotz August 26, 2025 13:11
Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

📝 Walkthrough

Walkthrough

Adds two top-level polyfill imports for iterator helpers and Set methods to the frontend entry point and introduces core-js@^3.45.1 as a runtime dependency in package.json. No other code, exports, or configuration changes.

Changes

Cohort / File(s) Summary
Polyfill initialization
frontend/javascripts/main.tsx
Prepends import "core-js/actual/iterator"; and import "core-js/actual/set"; before existing imports to ensure iterator helpers and Set methods are available at module initialization. No other changes.
Dependencies update
package.json
Adds runtime dependency "core-js": "^3.45.1" to dependencies. No removals or other section edits.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

dependencies

Suggested reviewers

  • philippotto

Poem

I nibbled bits of polyfill hay,
Sprinkled helpers to smooth the way.
Sets and iterators now hum along,
I hop, I test, I sing a song.
Ship it softly — code grown strong. 🐰✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7ff0099 and 7679aae.

📒 Files selected for processing (1)
  • frontend/javascripts/main.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/javascripts/main.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: backend-tests
  • GitHub Check: build-smoketest-push
  • GitHub Check: frontend-tests
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch iterator-helper-polyfill

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@hotzenklotz
Copy link
Member

How can we test this? Does webpack/esbuild not remove this immediately with our selected browser targets?

@hotzenklotz
Copy link
Member

... because some people haven't upgraded their browsers yet.

BTW, we have a browser check for the iterator helpers here:

Did those people at least see our warning to update their browser?

Base automatically changed from voxel-size-placeholder to master August 26, 2025 13:17
@normanrz
Copy link
Member Author

... because some people haven't upgraded their browsers yet.

BTW, we have a browser check for the iterator helpers here:

Did those people at least see our warning to update their browser?

It did show up. I don't think they would update their browser just for WK, though. Sometimes they can't do that on their own, because of IT policies.

@normanrz
Copy link
Member Author

How can we test this? Does webpack/esbuild not remove this immediately with our selected browser targets?

Maybe we should relax our browser targets. We don't rely on terribly new features apart for code convenience, no? Maybe we should switch to "defaults" and add the relevant polyfills.

@hotzenklotz
Copy link
Member

We don't rely on terribly new features apart for code convenience, no?

In case of the iterator helpers, it is a performance improvement more than code convenience. Not sure, what browser features we need for WebGL...

Maybe we should switch to "defaults"

defaults yields Chrome 109, which is from January 2023, more than 2.5 years ago. 🤔 Something like since 2024 has higher coverage and is easier to understand, but requires us to update it every so often.

... and add the relevant polyfills.

Isn't that the whole point of using browser list that the build tools automatically add polyfills?

@normanrz
Copy link
Member Author

We don't rely on terribly new features apart for code convenience, no?

In case of the iterator helpers, it is a performance improvement more than code convenience.

Well, a flatMap is pretty much

function* flatMap(it, func) {
    for (const value of it) {
        const mappedValues = func(value);
        yield* mappedValues;
    }
}

That is not a feature that just the runtime can implement, like a new data strucure or syntax. So, it falls in the code convienence category.

Not sure, what browser features we need for WebGL...

Nothing recent comes to mind.

Maybe we should switch to "defaults"

defaults yields Chrome 109, which is from January 2023, more than 2.5 years ago. 🤔 Something like since 2024 has higher coverage and is easier to understand, but requires us to update it every so often.

I think that would be much better than "last 3 versions".

... and add the relevant polyfills.

Isn't that the whole point of using browser list that the build tools automatically add polyfills?

Esbuild doesn't inject polyfills that and recommends the use of core-js. Since we are not using babel, I don't think we have any polyfills in there now.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/javascripts/main.tsx (1)

1-1: No explicit iterator-helper usage detected; reconsider this polyfill and its placement.

Our search across frontend/javascripts TS/TSX files found no direct calls to Iterator.from or any Iterator.prototype.* helpers. If your code isn’t actually using these iterator helpers, you may not need this import at all.

However, we did discover an additional entry point in frontend/javascripts/libs/DRACOLoader.ts (line 241) which spawns a web worker for DRACOWorker.worker.js. Polyfills loaded in main.tsx won’t apply inside that worker, potentially leading to runtime errors if the worker ever uses iterator helpers.

To ensure both correct feature detection and broad runtime support:

  • Consider removing the import entirely if iterator helpers aren’t in use.
  • Or centralize iterator polyfills in a shared polyfills.ts that’s imported before app initialization (and included in your worker bundles).
  • Alternatively, update libs/browser_feature_check to distinguish native vs. polyfilled support so that your “outdated browser” warning isn’t masked by a polyfill.

Let me know which approach you’d prefer.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 96a88c0 and 7ff0099.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • frontend/javascripts/main.tsx (1 hunks)
  • package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: backend-tests
  • GitHub Check: build-smoketest-push

"classnames": "^2.2.5",
"color-hash": "^2.0.1",
"comlink": "^4.3.0",
"core-js": "^3.45.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Runtime dep looks good; ensure the module path exists in this version.

Adding core-js as a production dependency is appropriate for runtime polyfills.

Run to verify the imported path resolves with the chosen version:


🏁 Script executed:

#!/bin/bash
# Confirm the iterator helpers entry exists in installed core-js
node -e "console.log(require.resolve('core-js/actual/iterator'))"

Length of output: 838


Invalid core-js import path requires correction

Running

node -e "console.log(require.resolve('core-js/actual/iterator'))"

on core-js@3.45.1 throws MODULE_NOT_FOUND, which means the entry point you’re importing doesn’t exist at runtime. You must update the import to a valid module path to avoid breaking your build.

• Locate every occurrence of

require('core-js/actual/iterator')

(or the equivalent ES module import) in your code.
• If you need the stage-3 iterator helpers proposal, replace it with:

-require('core-js/actual/iterator')
+require('core-js/proposals/iterator-helpers')

• If you only need core JS’s standard iterator polyfills, use one of the supported entry points, for example:

require('core-js/features/iterator');
// or
require('core-js/modules/es.array.iterator');

After updating, verify that the new path resolves correctly:

node -e "console.log(require.resolve('core-js/proposals/iterator-helpers'))"
🤖 Prompt for AI Agents
package.json around line 145: the project depends on core-js@3.45.1 but code
imports the non-existent entry point "core-js/actual/iterator", which causes
MODULE_NOT_FOUND at runtime; search the repo for any occurrences of
require('core-js/actual/iterator') or equivalent ESM imports and replace them
with a valid entry such as 'core-js/features/iterator' or
'core-js/modules/es.array.iterator' (or if you need the stage-3 proposal use
'core-js/proposals/iterator-helpers' and ensure that proposal package is
available), then run node -e "console.log(require.resolve('<chosen-path>'))" to
confirm resolution and update any build/config files accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants