@@ -17,7 +17,8 @@ import {
17
17
useSandpackNavigation ,
18
18
} from '@codesandbox/sandpack-react/unstyled' ;
19
19
import { OpenInCodeSandboxButton } from './OpenInCodeSandboxButton' ;
20
- import { ResetButton } from './ResetButton' ;
20
+ import { ReloadButton } from './ReloadButton' ;
21
+ import { ClearButton } from './ClearButton' ;
21
22
import { DownloadButton } from './DownloadButton' ;
22
23
import { IconChevron } from '../../Icon/IconChevron' ;
23
24
import { Listbox } from '@headlessui/react' ;
@@ -95,21 +96,21 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
95
96
// Note: in a real useEvent, onContainerResize would be omitted.
96
97
} , [ isMultiFile , onContainerResize ] ) ;
97
98
98
- const handleReset = ( ) => {
99
+ const handleClear = ( ) => {
99
100
/**
100
101
* resetAllFiles must come first, otherwise
101
102
* the previous content will appear for a second
102
103
* when the iframe loads.
103
104
*
104
105
* Plus, it should only prompt if there's any file changes
105
106
*/
106
- if (
107
- sandpack . editorState === 'dirty' &&
108
- confirm ( 'Reset all your edits too?' )
109
- ) {
107
+ if ( sandpack . editorState === 'dirty' && confirm ( 'Clear all your edits?' ) ) {
110
108
sandpack . resetAllFiles ( ) ;
111
109
}
110
+ refresh ( ) ;
111
+ } ;
112
112
113
+ const handleReload = ( ) => {
113
114
refresh ( ) ;
114
115
} ;
115
116
@@ -188,7 +189,8 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
188
189
className = "px-3 flex items-center justify-end text-start"
189
190
translate = "yes" >
190
191
< DownloadButton providedFiles = { providedFiles } />
191
- < ResetButton onReset = { handleReset } />
192
+ < ReloadButton onReload = { handleReload } />
193
+ < ClearButton onClear = { handleClear } />
192
194
< OpenInCodeSandboxButton />
193
195
{ activeFile . endsWith ( '.tsx' ) && (
194
196
< OpenInTypeScriptPlaygroundButton
0 commit comments