-
Notifications
You must be signed in to change notification settings - Fork 46
[AIT-230] Fix generator functions returning empty in Sandpack environment #3139
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
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe pull request addresses a Sandpack environment compatibility issue by simplifying code in the liveobjects example to remove unnecessary Array.from() conversions, adding TypeScript configuration to the Sandpack environment, and upgrading the TypeScript dependency from version 4 to 5 to improve type checking and bundling behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/components/Examples/ExamplesRenderer.tsx`:
- Around line 108-116: The current files prop unconditionally injects
'/tsconfig.json' which overwrites example-provided configs; change the
construction of the files object in ExamplesRenderer (where languageFiles and
SANDPACK_TSCONFIG are composed) to only add '/tsconfig.json' when it is not
already present on languageFiles (e.g., check
Object.prototype.hasOwnProperty.call(languageFiles, '/tsconfig.json') or
'/tsconfig.json' in Object.keys(languageFiles) before spreading), leaving the
rest of the files and customSetup (including devDependencies: { typescript:
'^5.0.0' }) unchanged.
c8b9d87 to
1cbb042
Compare
kennethkalmer
left a comment
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.
Nice one @matt423
1cbb042 to
dbb787a
Compare
dbb787a to
90bf320
Compare
Description
Fixes an issue where generator functions (e.g.,
tasks.keys(),tasks.entries()) returned empty results when running examples in the Sandpack environment.Related issue: AIT-230
Review App
Root Cause
The Sandpack bundler was transpiling ES6+ iterator/generator syntax to older JavaScript that didn't work correctly with the Ably SDK's custom iterators. This was caused by:
^4.0.0)tsconfig.jsonbeing passed to Sandpack, resulting in default (older) transpilation settingsChanges
ExamplesRenderer.tsx: Inject the shared
examples/tsconfig.jsoninto Sandpack:examples/tsconfig.jsondirectly to maintain a single source of truthcompilerOptions(withtarget: 'ES2020',lib: ['ES2020', 'DOM', 'DOM.Iterable']) as a hidden file^4.0.0to^5.0.0liveobjects-live-map example: Removed
Array.from()workarounds, now using direct iterator syntax:for (const [taskId] of tasks.entries())instead offor (const [taskId] of Array.from(tasks.entries()))Checklist
Summary by CodeRabbit
Chores
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.