Skip to content

Commit dae1e0f

Browse files
authored
Merge pull request #885 from live-codes/fix-rerender
Fix rerenders on firefox
2 parents 397cfda + db26765 commit dae1e0f

13 files changed

Lines changed: 15 additions & 17 deletions

File tree

docs/docs/features/tests.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Screenshots:
1919
- Automated tests increase the confidence in the code and can improve the quality of projects.
2020
- Allows <a href="https://en.wikipedia.org/wiki/Test-driven_development" target="_blank">Test-driven development (TDD)</a>.
2121
- Can be used for education and training by preparing projects with tests that are required to pass by the students' implementation (similar to <a href="https://www.freecodecamp.org/learn" target="_blank">freeCodeCamp</a>).
22-
- Can be used by wesites that offer coding challenges (similar to <a href="https://www.codewars.com/" target="_blank">Codewars</a>).
22+
- Can be used by websites that offer coding challenges (similar to <a href="https://www.codewars.com/" target="_blank">Codewars</a>).
2323

2424
## Demos
2525

docs/docs/languages/eta.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Eta
22

3-
[Eta](https://eta.js.org/) is an embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript.
3+
[Eta](https://eta.js.org/) is an embedded JS template engine for Node, Deno, and the browser. Lightweight, fast, and pluggable. Written in TypeScript.
44

55
## Usage
66

server/src/sandbox.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import cors from 'cors';
33
import express from 'express';
44
import fs from 'node:fs';
55
import path from 'node:path';
6+
import { sandboxVersion } from '../../src/livecodes/html/sandbox/index.ts';
67
import { dirname } from './utils.ts';
78

89
export const sandbox = ({ hostname, port }: { hostname: string; port: number }) => {
@@ -12,7 +13,7 @@ export const sandbox = ({ hostname, port }: { hostname: string; port: number })
1213
app.disable('x-powered-by');
1314

1415
const sandboxDir = path.resolve(dirname, 'sandbox');
15-
let sandboxVersionDir = path.resolve(sandboxDir, 'v8');
16+
let sandboxVersionDir = path.resolve(sandboxDir, sandboxVersion);
1617
fs.readdirSync(sandboxDir).forEach((v) => {
1718
if (fs.statSync(path.resolve(sandboxDir, v)).isDirectory()) {
1819
sandboxVersionDir = path.resolve(sandboxDir, v);

src/livecodes/UI/embed-ui.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ export const createEmbedUI = async ({
418418
return decodeURIComponent(iframeUrl.href);
419419
};
420420

421-
const codeTemlates = {
421+
const codeTemplates = {
422422
cdn: (data: FormData) => {
423423
const containerId = getContainerId();
424424
const containerHtml = `<div id="${containerId}"></div>`;
@@ -654,7 +654,7 @@ export default function App() {
654654

655655
previewIframe.src = getIframeUrl(formData);
656656
const embedType = (formData as any).type;
657-
const code = (codeTemlates as any)[embedType]?.(formData);
657+
const code = (codeTemplates as any)[embedType]?.(formData);
658658
const embedTypeLanguages: Record<string, Language> = {
659659
npm: 'javascript',
660660
react: 'jsx',

src/livecodes/core.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5566,13 +5566,6 @@ const createApi = (): API => {
55665566
await reloadCompiler(newAppConfig);
55675567
}
55685568
await applyConfig(newConfig, /* reload = */ true, currentConfig);
5569-
const content = getContentConfig(newConfig as Config);
5570-
const hasContent = Object.values(content).some((value) => value != null);
5571-
if (hasContent) {
5572-
await loadConfig(newAppConfig);
5573-
} else if (shouldRun && newAppConfig.autoupdate === true) {
5574-
await run();
5575-
}
55765569
return newAppConfig;
55775570
};
55785571

src/livecodes/html/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { predefinedValues } from '../utils/utils';
44

55
// @ts-ignore
6-
import resultTemplateRaw from './sandbox/v8/index.html?raw';
6+
import resultTemplateRaw from './sandbox/v9/index.html?raw';
77
// @ts-ignore
88
import appHTMLRaw from './app.html?raw';
99
// @ts-ignore

src/livecodes/html/language-info.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ <h3 data-i18n="language-info:ejs.name">EJS</h3>
434434
<section data-lang="eta">
435435
<h3 data-i18n="language-info:eta.name">Eta</h3>
436436
<div data-i18n="language-info:eta.desc">
437-
Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable.
437+
Embedded JS template engine for Node, Deno, and the browser. Lightweight, fast, and pluggable.
438438
Written in TypeScript.
439439
</div>
440440
<ul data-i18n="language-info:eta.link" data-i18n-prop="innerHTML">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const sandboxVersion = 'v9';
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
window.addEventListener('message', function (event) {
66
var html = event.data.result || event.data.html;
77
if (html) {
8+
document.open();
89
document.write(html);
910
document.close();
1011
}

0 commit comments

Comments
 (0)