Skip to content

Commit f6efe4e

Browse files
committed
Merge branch 'development' into fix/root-detection
2 parents 46dcd65 + 1a2b11d commit f6efe4e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

ui/arduino/store.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const newFileContent = `# This program was created in Arduino Lab for MicroPytho
99
1010
print('Hello, MicroPython!')
1111
`
12+
async function sleep(ms) {
13+
return new Promise(resolve => setTimeout(resolve, ms));
14+
}
1215

1316
async function confirmDialog(msg, cancelMsg, confirmMsg) {
1417
// cancelMsg = cancelMsg || 'Cancel'
@@ -103,15 +106,16 @@ async function store(state, emitter) {
103106
emitter.emit('render')
104107
})
105108

106-
emitter.on('change-view', (view) => {
107-
if (state.view === 'file-manager') {
108-
if (view != state.view) {
109-
state.selectedFiles = []
110-
}
111-
emitter.emit('refresh-files')
109+
emitter.on('change-view', async (view) => {
110+
if (state.view === view) {
111+
return
112+
} else {
113+
state.selectedFiles = []
112114
}
113115
if(view === 'file-manager') {
114116
emitter.emit('stop')
117+
await sleep(250) // Give the board time to stop the program and return to the prompt
118+
emitter.emit('refresh-files')
115119
}
116120
state.view = view
117121
emitter.emit('render')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy