Skip to content

Fix rerenders on firefox#885

Merged
hatemhosny merged 3 commits intodevelopfrom
fix-rerender
Oct 1, 2025
Merged

Fix rerenders on firefox#885
hatemhosny merged 3 commits intodevelopfrom
fix-rerender

Conversation

@hatemhosny
Copy link
Copy Markdown
Collaborator

@hatemhosny hatemhosny commented Oct 1, 2025

Summary by CodeRabbit

  • New Features
    • Upgraded HTML sandbox to v9 for previews.
  • Bug Fixes
    • Improved preview reliability by opening the document stream before writing content.
  • Refactor
    • Streamlined config update flow; removed some implicit auto-run/content reload behaviors after config changes.
  • Documentation
    • Fixed typos and clarified wording in feature docs, language info, and translations (e.g., “Lightweight” for Eta, “websites”).
  • Chores
    • Centralized sandbox versioning and replaced hardcoded version references with a single source of truth.

@netlify
Copy link
Copy Markdown

netlify Bot commented Oct 1, 2025

Deploy Preview for livecodes ready!

Name Link
🔨 Latest commit db26765
🔍 Latest deploy log https://app.netlify.com/projects/livecodes/deploys/68dd9e8b136421000825a260
😎 Deploy Preview https://deploy-preview-885--livecodes.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 1, 2025

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The provided title “Fix rerenders on firefox” does not describe any of the changes in this pull request, which focus on updating sandbox version handling, adding new service methods, and correcting typos in documentation and identifiers rather than addressing Firefox rendering issues. Please rename the pull request to summarize the actual changes, for example “Upgrade sandbox to v9 with dynamic versioning and add getCompilerUrl/getOrigin methods,” so that it accurately reflects the modifications made.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-rerender

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c72074 and db26765.

📒 Files selected for processing (6)
  • docs/docs/features/tests.mdx (1 hunks)
  • docs/docs/languages/eta.mdx (1 hunks)
  • src/livecodes/UI/embed-ui.ts (2 hunks)
  • src/livecodes/html/language-info.html (1 hunks)
  • src/livecodes/i18n/locales/en/language-info.lokalise.json (1 hunks)
  • src/livecodes/i18n/locales/en/language-info.ts (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • src/livecodes/UI/embed-ui.ts
  • docs/docs/features/tests.mdx
  • docs/docs/languages/eta.mdx
  • src/livecodes/i18n/locales/en/language-info.lokalise.json
⏰ 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: Codacy Static Code Analysis
  • GitHub Check: Redirect rules - livecodes
  • GitHub Check: Header rules - livecodes
  • GitHub Check: Pages changed - livecodes
  • GitHub Check: tests (18.x, 4)
  • GitHub Check: build
  • GitHub Check: build (18.x)
  • GitHub Check: tests (18.x, 2)
  • GitHub Check: tests (18.x, 1)
  • GitHub Check: tests (18.x, 3)
  • GitHub Check: tests (18.x, 5)
  • GitHub Check: build (18.x)
🔇 Additional comments (3)
src/livecodes/html/language-info.html (2)

437-438: Typo correction looks good.

The spelling correction from "Lighweight" to "Lightweight" improves the documentation quality.


437-438: Clarify the connection between typo fixes and Firefox rerenders.

The PR is titled "Fix rerenders on firefox" but the changes shown in these files are typo corrections in documentation strings. Could you clarify how these typo fixes relate to the Firefox rerender issue? Are there additional changes in other files that directly address the rerender problem?

src/livecodes/i18n/locales/en/language-info.ts (1)

1-1: No action needed: typo fix applied to source file.
The source localization file (language-info.lokalise.json) already contains the corrected “Lightweight,” so the change in the generated file will persist.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 1, 2025

Size Change: -318 B (-0.03%)

Total Size: 955 kB

ℹ️ View Unchanged
Filename Size Change
./build/404.html 1 kB 0 B
./build/app.html 250 B 0 B
./build/index.html 2.46 kB +2 B (+0.08%)
./build/livecodes/app.js 111 kB -111 B (-0.1%)
./build/livecodes/app.css 22.4 kB 0 B
./build/livecodes/assets.js 8.62 kB +9 B (+0.1%)
./build/livecodes/assets/noop.js 18 B 0 B
./build/livecodes/assets/templates/diagrams-starter.html 2.19 kB 0 B
./build/livecodes/backup.js 3.71 kB +1 B (+0.03%)
./build/livecodes/blockly.js 13.3 kB +8 B (+0.06%)
./build/livecodes/broadcast.js 1.19 kB 0 B
./build/livecodes/bundle-types.js 4.37 kB 0 B
./build/livecodes/code-to-image.js 9.11 kB +5 B (+0.05%)
./build/livecodes/codejar.js 17.6 kB 0 B
./build/livecodes/codemirror.js 6.33 kB 0 B
./build/livecodes/compile.page.js 2.39 kB 0 B
./build/livecodes/compile.worker.js 14.3 kB -9 B (-0.06%)
./build/livecodes/compiler-utils.js 3.17 kB -7 B (-0.22%)
./build/livecodes/custom-editor-utils.js 198 B 0 B
./build/livecodes/deploy.js 6.9 kB +31 B (+0.45%)
./build/livecodes/editor-settings.js 17.7 kB -50 B (-0.28%)
./build/livecodes/embed-ui.js 5.55 kB -3 B (-0.05%)
./build/livecodes/embed.js 89.4 kB -120 B (-0.13%)
./build/livecodes/export.js 3.89 kB 0 B
./build/livecodes/firebase.js 22.7 kB 0 B
./build/livecodes/format.worker.js 13.4 kB -14 B (-0.1%)
./build/livecodes/google-fonts.js 7.12 kB 0 B
./build/livecodes/headless.js 78.3 kB -17 B (-0.02%)
./build/livecodes/i18n-ar-language-info.json 5.23 kB 0 B
./build/livecodes/i18n-ar-translation.json 9.33 kB 0 B
./build/livecodes/i18n-de-language-info.json 5.25 kB 0 B
./build/livecodes/i18n-de-translation.json 9.44 kB 0 B
./build/livecodes/i18n-en-language-info.json 4.53 kB -8 B (-0.18%)
./build/livecodes/i18n-en-translation.json 8.03 kB 0 B
./build/livecodes/i18n-es-language-info.json 5 kB 0 B
./build/livecodes/i18n-es-translation.json 9.17 kB 0 B
./build/livecodes/i18n-fa-language-info.json 5.35 kB 0 B
./build/livecodes/i18n-fa-translation.json 9.48 kB 0 B
./build/livecodes/i18n-fr-language-info.json 5.17 kB 0 B
./build/livecodes/i18n-fr-translation.json 9.42 kB 0 B
./build/livecodes/i18n-hi-language-info.json 5.78 kB 0 B
./build/livecodes/i18n-hi-translation.json 9.95 kB 0 B
./build/livecodes/i18n-it-language-info.json 5.04 kB 0 B
./build/livecodes/i18n-it-translation.json 9.26 kB 0 B
./build/livecodes/i18n-ja-language-info.json 5.57 kB 0 B
./build/livecodes/i18n-ja-translation.json 9.61 kB 0 B
./build/livecodes/i18n-pt-language-info.json 5.05 kB 0 B
./build/livecodes/i18n-pt-translation.json 9.35 kB 0 B
./build/livecodes/i18n-ru-language-info.json 5.56 kB 0 B
./build/livecodes/i18n-ru-translation.json 10.3 kB 0 B
./build/livecodes/i18n-ur-language-info.json 5.81 kB 0 B
./build/livecodes/i18n-ur-translation.json 9.78 kB 0 B
./build/livecodes/i18n-zh-CN-language-info.json 4.9 kB 0 B
./build/livecodes/i18n-zh-CN-translation.json 8.64 kB 0 B
./build/livecodes/i18n.js 20.2 kB +36 B (+0.18%)
./build/livecodes/import-src.js 16 kB -11 B (-0.07%)
./build/livecodes/import.js 14.5 kB -35 B (-0.24%)
./build/livecodes/index.js 5.36 kB -27 B (-0.5%)
./build/livecodes/lang-art-template-compiler.js 1.65 kB 0 B
./build/livecodes/lang-assemblyscript-compiler.js 290 B 0 B
./build/livecodes/lang-assemblyscript-script.js 386 B 0 B
./build/livecodes/lang-astro-compiler.js 2.34 kB 0 B
./build/livecodes/lang-clio-compiler.js 1.55 kB 0 B
./build/livecodes/lang-commonlisp-script.js 123 B 0 B
./build/livecodes/lang-cpp-script.js 1.75 kB 0 B
./build/livecodes/lang-cpp-wasm-script.js 2.84 kB 0 B
./build/livecodes/lang-csharp-wasm-script.js 2.18 kB 0 B
./build/livecodes/lang-diagrams-compiler-esm.js 5.09 kB 0 B
./build/livecodes/lang-dot-compiler.js 1.66 kB 0 B
./build/livecodes/lang-ejs-compiler.js 1.63 kB 0 B
./build/livecodes/lang-eta-compiler.js 1.65 kB 0 B
./build/livecodes/lang-fennel-compiler.js 1.61 kB 0 B
./build/livecodes/lang-gleam-compiler.js 3.09 kB 0 B
./build/livecodes/lang-go-wasm-script.js 3.26 kB 0 B
./build/livecodes/lang-haml-compiler.js 1.65 kB 0 B
./build/livecodes/lang-handlebars-compiler.js 1.92 kB 0 B
./build/livecodes/lang-imba-compiler.js 147 B 0 B
./build/livecodes/lang-java-script.js 4.05 kB 0 B
./build/livecodes/lang-jinja-compiler.js 1.65 kB 0 B
./build/livecodes/lang-julia-script.js 3.3 kB 0 B
./build/livecodes/lang-liquid-compiler.js 1.68 kB 0 B
./build/livecodes/lang-lua-wasm-script.js 205 B 0 B
./build/livecodes/lang-malina-compiler.js 2.96 kB 0 B
./build/livecodes/lang-mustache-compiler.js 1.65 kB 0 B
./build/livecodes/lang-nunjucks-compiler.js 1.93 kB 0 B
./build/livecodes/lang-perl-script.js 268 B 0 B
./build/livecodes/lang-php-wasm-script.js 347 B 0 B
./build/livecodes/lang-postgresql-compiler-esm.js 1.73 kB 0 B
./build/livecodes/lang-prolog-script.js 204 B 0 B
./build/livecodes/lang-pug-compiler.js 371 B 0 B
./build/livecodes/lang-python-wasm-script.js 1.92 kB 0 B
./build/livecodes/lang-r-script-esm.js 2.44 kB 0 B
./build/livecodes/lang-rescript-compiler-esm.js 2.16 kB 0 B
./build/livecodes/lang-rescript-formatter.js 1.52 kB 0 B
./build/livecodes/lang-riot-compiler.js 2.81 kB 0 B
./build/livecodes/lang-ruby-wasm-script.js 1.71 kB 0 B
./build/livecodes/lang-scss-compiler.js 1.71 kB 0 B
./build/livecodes/lang-solid-compiler.js 263 B 0 B
./build/livecodes/lang-sql-compiler.js 1.64 kB 0 B
./build/livecodes/lang-sql-script.js 1.95 kB 0 B
./build/livecodes/lang-svelte-compiler.js 4.69 kB 0 B
./build/livecodes/lang-tcl-script.js 1.82 kB 0 B
./build/livecodes/lang-teal-compiler.js 1.72 kB 0 B
./build/livecodes/lang-twig-compiler.js 1.64 kB 0 B
./build/livecodes/lang-vento-compiler.js 1.68 kB 0 B
./build/livecodes/lang-vue-compiler.js 6.09 kB 0 B
./build/livecodes/lang-vue2-compiler.js 3.47 kB 0 B
./build/livecodes/lang-wat-compiler.js 348 B 0 B
./build/livecodes/lang-wat-script.js 1.58 kB 0 B
./build/livecodes/language-info.js 7.71 kB +1 B (+0.01%)
./build/livecodes/monaco-lang-astro.js 947 B 0 B
./build/livecodes/monaco-lang-clio.js 639 B 0 B
./build/livecodes/monaco-lang-imba.js 7.35 kB 0 B
./build/livecodes/monaco-lang-wat.js 2.46 kB 0 B
./build/livecodes/monaco.js 10.1 kB 0 B
./build/livecodes/open.js 6.21 kB +15 B (+0.24%)
./build/livecodes/processor-lightningcss-compiler.js 1.88 kB 0 B
./build/livecodes/processor-postcss-compiler.js 2.02 kB 0 B
./build/livecodes/processor-tailwindcss-compiler.js 5.19 kB -18 B (-0.35%)
./build/livecodes/processor-unocss-compiler.js 355 B 0 B
./build/livecodes/processor-windicss-compiler.js 450 B 0 B
./build/livecodes/quill.css 697 B 0 B
./build/livecodes/quill.js 5.76 kB +16 B (+0.28%)
./build/livecodes/resources.js 3.43 kB +2 B (+0.06%)
./build/livecodes/result-utils.js 1.17 kB 0 B
./build/livecodes/share.js 3.81 kB -1 B (-0.03%)
./build/livecodes/snippets.js 6.04 kB -11 B (-0.18%)
./build/livecodes/sync-ui.js 3.25 kB -2 B (-0.06%)
./build/livecodes/sync.js 3.52 kB 0 B
./build/livecodes/sync.worker.js 29.7 kB 0 B
./build/livecodes/templates.js 25.4 kB 0 B
./build/sdk/livecodes.js 3.96 kB 0 B
./build/sdk/livecodes.umd.js 4.02 kB 0 B
./build/sdk/package.json 293 B 0 B
./build/sdk/react.js 4.24 kB 0 B
./build/sdk/vue.js 4.36 kB 0 B

compressed-size-action

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Oct 1, 2025

Deploying livecodes with  Cloudflare Pages  Cloudflare Pages

Latest commit: db26765
Status: ✅  Deploy successful!
Preview URL: https://99df237e.livecodes.pages.dev
Branch Preview URL: https://fix-rerender.livecodes.pages.dev

View logs

Copy link
Copy Markdown

@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: 0

🧹 Nitpick comments (1)
server/src/sandbox.ts (1)

16-21: Consider more selective version directory discovery.

The current logic overwrites sandboxVersionDir with any subdirectory found in sandboxDir. This could lead to issues if:

  • Multiple version directories exist (only the last one is used)
  • Non-version directories exist in sandboxDir

Consider 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

📥 Commits

Reviewing files that changed from the base of the PR and between 397cfda and 9c72074.

📒 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! The document.open() call fixes Firefox rerenders.

Adding document.open() before document.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 sandboxVersion as a single source of truth is good practice and simplifies version management across the codebase.

server/src/sandbox.ts (1)

6-6: Verify the .ts extension in the import path.

The import includes the .ts file 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 sandboxVersion constant.


13-13: LGTM! Version assignment is clean.

Using the imported sandboxVersion maintains consistency across the codebase.


17-18: LGTM! New API methods added.

The new getCompilerUrl() and getOrigin() methods provide useful functionality and are implemented correctly.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Oct 1, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@hatemhosny hatemhosny merged commit dae1e0f into develop Oct 1, 2025
24 of 25 checks passed
@livecodes-ci
Copy link
Copy Markdown
Contributor

livecodes-ci Bot commented Oct 1, 2025

i18n Actions

Source PR has been merged into the default branch.

Maintainers can comment .i18n-update-push to trigger the i18n update workflow and push the changes to Lokalise.

@hatemhosny hatemhosny deleted the fix-rerender branch October 2, 2025 08:55
@hatemhosny
Copy link
Copy Markdown
Collaborator Author

.i18n-update-push

@livecodes-ci
Copy link
Copy Markdown
Contributor

livecodes-ci Bot commented Oct 2, 2025

i18n Actions: .i18n-update-push

Localization updated and pushed to Lokalise.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant