Skip to content

Commit

Permalink
Fix p5 run errors (#1147)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sra405 authored Nov 29, 2024
1 parent 18e1e3d commit 82e197c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

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).

## Unreleased

### Fixed

- Enable p5 code to be ran multiple times without runner errors (#1147)

## [0.28.9] - 2024-11-27

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ const SkulptRunner = ({ active, outputPanels = ["text", "visual"] }) => {
if (active) {
if (codeRunTriggered) {
runCode();
} else if (!senseHatAlwaysEnabled) {
setCodeHasVisualOutput(false);
}
}
}, [codeRunTriggered, active]);
Expand Down Expand Up @@ -403,7 +401,6 @@ const SkulptRunner = ({ active, outputPanels = ["text", "visual"] }) => {
})
.finally(() => {
dispatch(codeRunHandled());
setCodeHasVisualOutput(false);
});
myPromise.then(function (_mod) {});
};
Expand Down

0 comments on commit 82e197c

Please sign in to comment.