Skip to content

Commit 82e197c

Browse files
authored
Fix p5 run errors (#1147)
Reported that when running p5 code more than once the runner breaks and errors. This remove setting visualOutput to false and uses initial state and rerenders to set the correct visual output behaviour. This is still dynamic and works well when adding code that requires visualisation as well as always showing for the sense hat model
1 parent 18e1e3d commit 82e197c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// The 'service' property is the name of the service for the container that VS Code should
1313
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
14-
"service": "react-ui",
14+
"service": "app",
1515

1616
// The optional 'workspaceFolder' property is the path VS Code should open by default when
1717
// connected. This is typically a file mount in .devcontainer/docker-compose.yml

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## Unreleased
8+
9+
### Fixed
10+
11+
- Enable p5 code to be ran multiple times without runner errors (#1147)
12+
713
## [0.28.9] - 2024-11-27
814

915
### Fixed

src/components/Editor/Runners/PythonRunner/SkulptRunner/SkulptRunner.jsx

-3
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ const SkulptRunner = ({ active, outputPanels = ["text", "visual"] }) => {
106106
if (active) {
107107
if (codeRunTriggered) {
108108
runCode();
109-
} else if (!senseHatAlwaysEnabled) {
110-
setCodeHasVisualOutput(false);
111109
}
112110
}
113111
}, [codeRunTriggered, active]);
@@ -403,7 +401,6 @@ const SkulptRunner = ({ active, outputPanels = ["text", "visual"] }) => {
403401
})
404402
.finally(() => {
405403
dispatch(codeRunHandled());
406-
setCodeHasVisualOutput(false);
407404
});
408405
myPromise.then(function (_mod) {});
409406
};

0 commit comments

Comments
 (0)