fixed create and duplicate behavior
This commit is contained in:
parent
4e0a60db00
commit
0355c358b8
3 changed files with 26 additions and 22 deletions
|
|
@ -157,9 +157,9 @@ export function Repl({ embedded = false }) {
|
|||
|
||||
const handleTogglePlay = async () => editorRef.current?.toggle();
|
||||
|
||||
// payload = {reset?: boolean, code?: string, evaluate?: boolean, patternID?: string }
|
||||
// payload = {reset?: boolean, code?: string, evaluate?: boolean, pattern?: string }
|
||||
const handleUpdate = async (payload) => {
|
||||
const { reset = false, code = null, evaluate = true, patternID = null } = payload;
|
||||
const { reset = false, code = null, evaluate = true, pattern = null } = payload;
|
||||
|
||||
if (reset) {
|
||||
clearCanvas();
|
||||
|
|
@ -167,9 +167,9 @@ export function Repl({ embedded = false }) {
|
|||
editorRef.current.repl.setCps(1);
|
||||
await prebake(); // declare default samples
|
||||
}
|
||||
if (code != null) {
|
||||
if (code != null && pattern != null) {
|
||||
editorRef.current.setCode(code);
|
||||
setViewingPattern(patternID);
|
||||
setViewingPattern(pattern);
|
||||
}
|
||||
if (evaluate) {
|
||||
editorRef.current.evaluate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue