Skip to content

Commit 88a153e

Browse files
authored
Merge pull request #302 from JMarques1196/main
Fix: Infinite Loop using Livecode
2 parents 45353c8 + 11ea22a commit 88a153e

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

components/playgroundEditor/LiveCodes.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Dispatch, SetStateAction, useEffect, useState } from "react";
1+
import { useEffect, useState } from "react";
22
import type { Config, Playground } from "livecodes";
33
import LiveCodesPlayground from "livecodes/react";
44
import { luaTestRunner, type Language } from "lib/playground/livecodes";
@@ -7,12 +7,10 @@ import { useDarkTheme } from "hooks/darkTheme";
77
export default function LiveCodes({
88
language,
99
code,
10-
setCode,
1110
tests,
1211
}: {
1312
language: Language;
1413
code: string;
15-
setCode: Dispatch<SetStateAction<string>>;
1614
tests: string;
1715
}) {
1816
const [playground, setPlayground] = useState<Playground | undefined>();
@@ -26,17 +24,14 @@ export default function LiveCodes({
2624
await sdk.runTests();
2725
}
2826
});
29-
sdk.watch("code", (changed) => {
30-
setCode(changed.code.script.content);
31-
});
3227
};
3328

3429
useEffect(() => {
3530
playground?.setConfig({ theme: darkTheme ? "dark" : "light" });
3631
}, [playground, darkTheme]);
3732

3833
const baseConfig: Partial<Config> = {
39-
autoupdate: false,
34+
autoupdate: true,
4035
languages: [language === "jupyter" ? "python-wasm" : language],
4136
script: {
4237
language: language === "jupyter" ? "python-wasm" : language,

components/playgroundEditor/index.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@ export default function Editor({
1515
tests: string;
1616
}) {
1717
if (isLiveCodesLanguage(language)) {
18-
return (
19-
<LiveCodes
20-
language={language}
21-
code={code}
22-
setCode={setCode}
23-
tests={tests}
24-
/>
25-
);
18+
return <LiveCodes language={language} code={code} tests={tests} />;
2619
}
2720
return <PlaygroundEditor language={language} code={code} setCode={setCode} />;
2821
}

lib/wasm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable */
2-
export default function checkWasm() {
2+
export default function check() {
33
try {
44
if (
55
typeof WebAssembly === "object" &&

public/locales/en/categories.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
"audio": "Audio",
1010
"audiofilters": "Audio Filters",
1111
"automaton": "Automaton",
12+
"avltree": "AVL Tree",
1213
"backtracking": "Backtracking",
1314
"bags": "Bags",
1415
"basic": "Basic",
1516
"basicsoftensorflow": "Basics of Tensorflow",
1617
"biginteger": "Big Integer",
1718
"binary": "Binary",
1819
"binaryheap": "Binary Heap",
20+
"binarysearchtree": "Binary Search Tree",
1921
"binarytree": "Binary Tree",
2022
"bit": "Bit",
2123
"bitmanipulation": "Bit Manipulation",
@@ -27,6 +29,7 @@
2729
"cellularautomata": "Cellular Automata",
2830
"checksum": "Checksum",
2931
"ciphers": "Ciphers",
32+
"circularqueue": "Circularqueue",
3033
"classificationalgorithms": "Classification Algorithms",
3134
"clientserver": "Client Server",
3235
"cll": "CLL",
@@ -60,11 +63,13 @@
6063
"discretemathematics": "Discrete Mathematics",
6164
"disjointset": "Disjoint Set",
6265
"disjointsetunion": "Disjointsetunion",
66+
"diskscheduling": "Diskscheduling",
6367
"distance": "Distance",
6468
"distances": "Distances",
6569
"dithering": "Dithering",
6670
"divideandconquer": "Divide and Conquer",
6771
"divisibilityofintegers": "Divisibility of Integers",
72+
"docs": "Docs",
6873
"dynamic": "Dynamic",
6974
"dynamicarray": "Dynamic Array",
7075
"dynamicprogramming": "Dynamic Programming",
@@ -73,6 +78,7 @@
7378
"encoders": "Encoders",
7479
"entities": "Entities",
7580
"esolang": "Esolang",
81+
"example": "Example",
7682
"exercism": "Exercism",
7783
"factorization": "Factorization",
7884
"filetransfer": "File Transfer",
@@ -92,6 +98,7 @@
9298
"graphics": "Graphics",
9399
"graphs": "Graphs",
94100
"greatestcommondivisor": "Greatest Common Divisor",
101+
"greedy": "Greedy",
95102
"greedyalgorithms": "Greedy Algorithms",
96103
"greedyapproach": "Greedy Approach",
97104
"greedymethods": "Greedy Methods",
@@ -105,11 +112,13 @@
105112
"http": "Http",
106113
"imageprocessing": "Image Processing",
107114
"io": "Io",
115+
"kdtree": "Kd Tree",
108116
"knapsack": "Knapsack",
109117
"levenshtein": "Levenshtein",
110118
"linearalgebra": "Linear Algebra",
111119
"linearprogramming": "Linear Programming",
112120
"linearregression": "Linear Regression",
121+
"lineclipping": "Lineclipping",
113122
"linkedlist": "Linked List",
114123
"list": "List",
115124
"logisticregression": "Logistic-Regression",
@@ -180,10 +189,12 @@
180189
"recursive": "Recursive",
181190
"regressionalgorithms": "Regression Algorithms",
182191
"robotics": "Robotics",
192+
"rsa": "Rsa",
183193
"scheduling": "Scheduling",
184194
"scripts": "Scripts",
185195
"sdbmhash": "Sdbm Hash",
186196
"searches": "Searches",
197+
"segmenttree": "Segment Tree",
187198
"segmenttrees": "Segment Trees",
188199
"sequences": "Sequences",
189200
"series": "Series",
@@ -197,6 +208,7 @@
197208
"spanningtree": "Spanning Tree",
198209
"specializedstructure": "Specialized Structure",
199210
"specialnumbers": "Special Numbers",
211+
"splaytree": "Splay Tree",
200212
"sqrt": "Sqrt",
201213
"stablemarriage": "Stable Marriage",
202214
"stacks": "Stacks",
@@ -205,6 +217,7 @@
205217
"strings": "Strings",
206218
"structure": "Structure",
207219
"structures": "Structures",
220+
"suffixtree": "Suffix Tree",
208221
"sum": "Sum",
209222
"textclassification": "Text Classification",
210223
"threads": "Threads",

0 commit comments

Comments
 (0)