@@ -17,7 +17,8 @@ import {
1717 useSandpackNavigation ,
1818} from '@codesandbox/sandpack-react/unstyled' ;
1919import { OpenInCodeSandboxButton } from './OpenInCodeSandboxButton' ;
20- import { ResetButton } from './ResetButton' ;
20+ import { ReloadButton } from './ReloadButton' ;
21+ import { ClearButton } from './ClearButton' ;
2122import { DownloadButton } from './DownloadButton' ;
2223import { IconChevron } from '../../Icon/IconChevron' ;
2324import { Listbox } from '@headlessui/react' ;
@@ -95,21 +96,21 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
9596 // Note: in a real useEvent, onContainerResize would be omitted.
9697 } , [ isMultiFile , onContainerResize ] ) ;
9798
98- const handleReset = ( ) => {
99+ const handleClear = ( ) => {
99100 /**
100101 * resetAllFiles must come first, otherwise
101102 * the previous content will appear for a second
102103 * when the iframe loads.
103104 *
104105 * Plus, it should only prompt if there's any file changes
105106 */
106- if (
107- sandpack . editorState === 'dirty' &&
108- confirm ( 'Reset all your edits too?' )
109- ) {
107+ if ( sandpack . editorState === 'dirty' && confirm ( 'Clear all your edits?' ) ) {
110108 sandpack . resetAllFiles ( ) ;
111109 }
110+ refresh ( ) ;
111+ } ;
112112
113+ const handleReload = ( ) => {
113114 refresh ( ) ;
114115 } ;
115116
@@ -188,7 +189,8 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
188189 className = "px-3 flex items-center justify-end text-start"
189190 translate = "yes" >
190191 < DownloadButton providedFiles = { providedFiles } />
191- < ResetButton onReset = { handleReset } />
192+ < ReloadButton onReload = { handleReload } />
193+ < ClearButton onClear = { handleClear } />
192194 < OpenInCodeSandboxButton />
193195 { activeFile . endsWith ( '.tsx' ) && (
194196 < OpenInTypeScriptPlaygroundButton
0 commit comments