Fix rerenders on firefox#885
Conversation
✅ Deploy Preview for livecodes ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (4)
⏰ 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). (12)
🔇 Additional comments (3)
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. Comment |
|
Size Change: -318 B (-0.03%) Total Size: 955 kB ℹ️ View Unchanged
|
Deploying livecodes with
|
| Latest commit: |
db26765
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://99df237e.livecodes.pages.dev |
| Branch Preview URL: | https://fix-rerender.livecodes.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
server/src/sandbox.ts (1)
16-21: Consider more selective version directory discovery.The current logic overwrites
sandboxVersionDirwith any subdirectory found insandboxDir. This could lead to issues if:
- Multiple version directories exist (only the last one is used)
- Non-version directories exist in
sandboxDirConsider filtering for directories that match a version pattern (e.g.,
/^v\d+$/) or explicitly checking for expected version directories.Example refactor:
const sandboxDir = path.resolve(dirname, 'sandbox'); let sandboxVersionDir = path.resolve(sandboxDir, sandboxVersion); - fs.readdirSync(sandboxDir).forEach((v) => { - if (fs.statSync(path.resolve(sandboxDir, v)).isDirectory()) { - sandboxVersionDir = path.resolve(sandboxDir, v); - } - }); + const versionDirs = fs.readdirSync(sandboxDir) + .filter((v) => /^v\d+$/.test(v) && fs.statSync(path.resolve(sandboxDir, v)).isDirectory()) + .sort(); + if (versionDirs.length > 0) { + sandboxVersionDir = path.resolve(sandboxDir, versionDirs[versionDirs.length - 1]); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
server/src/sandbox.ts(2 hunks)src/livecodes/core.ts(0 hunks)src/livecodes/html/index.ts(1 hunks)src/livecodes/html/sandbox/index.ts(1 hunks)src/livecodes/html/sandbox/v9/index.html(1 hunks)src/livecodes/services/sandbox.ts(2 hunks)
💤 Files with no reviewable changes (1)
- src/livecodes/core.ts
🧰 Additional context used
🧬 Code graph analysis (2)
server/src/sandbox.ts (1)
src/livecodes/html/sandbox/index.ts (1)
sandboxVersion(1-1)
src/livecodes/services/sandbox.ts (1)
src/livecodes/html/sandbox/index.ts (1)
sandboxVersion(1-1)
⏰ 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). (12)
- GitHub Check: tests (18.x, 4)
- GitHub Check: tests (18.x, 1)
- GitHub Check: tests (18.x, 3)
- GitHub Check: tests (18.x, 5)
- GitHub Check: tests (18.x, 2)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Redirect rules - livecodes
- GitHub Check: Header rules - livecodes
- GitHub Check: Pages changed - livecodes
- GitHub Check: build
- GitHub Check: build (18.x)
- GitHub Check: build (18.x)
🔇 Additional comments (7)
src/livecodes/html/index.ts (1)
6-6: LGTM! Import path correctly updated to v9.The import path change aligns with the sandbox version bump and ensures the application uses the updated v9 template with the Firefox rerender fix.
src/livecodes/html/sandbox/v9/index.html (1)
8-8: LGTM! Thedocument.open()call fixes Firefox rerenders.Adding
document.open()beforedocument.write()is the correct fix for preventing unwanted rerenders in Firefox. This clears the document and opens a new output stream, ensuring clean rendering without multiple reflows.src/livecodes/html/sandbox/index.ts (1)
1-1: LGTM! Centralized version constant.Exporting
sandboxVersionas a single source of truth is good practice and simplifies version management across the codebase.server/src/sandbox.ts (1)
6-6: Verify the.tsextension in the import path.The import includes the
.tsfile extension, which is unusual for module imports. Ensure this is required by your build system or module resolution configuration.src/livecodes/services/sandbox.ts (3)
1-1: LGTM! Import uses dynamic sandboxVersion.The import correctly replaces the hardcoded 'v8' with the centralized
sandboxVersionconstant.
13-13: LGTM! Version assignment is clean.Using the imported
sandboxVersionmaintains consistency across the codebase.
17-18: LGTM! New API methods added.The new
getCompilerUrl()andgetOrigin()methods provide useful functionality and are implemented correctly.
|
i18n ActionsSource PR has been merged into the default branch. Maintainers can comment |
|
.i18n-update-push |
i18n Actions:
|
| Name | Description |
|---|---|
| New Branch for i18n | i18n/live-codes/fix-rerender |
| Last Commit SHA | dae1e0f |
Maintainers can comment .i18n-update-pull after translation is done to trigger the i18n pull workflow and pull the changes back to Github.

Summary by CodeRabbit