Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/components/MDX/Sandpack/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
Fragment,
} from 'react';
import cn from 'classnames';
import {
FileTabs,
useSandpack,
useSandpackNavigation,
} from '@codesandbox/sandpack-react/unstyled';
import {FileTabs, useSandpack} from '@codesandbox/sandpack-react/unstyled';
import {OpenInCodeSandboxButton} from './OpenInCodeSandboxButton';
import {ReloadButton} from './ReloadButton';
import {ClearButton} from './ClearButton';
Expand Down Expand Up @@ -55,9 +51,7 @@
// By default, show the dropdown because all tabs may not fit.
// We don't know whether they'll fit or not until after hydration:
const [showDropdown, setShowDropdown] = useState(true);
const {activeFile, setActiveFile, visibleFiles, clients} = sandpack;
const clientId = Object.keys(clients)[0];
const {refresh} = useSandpackNavigation(clientId);
const {activeFile, setActiveFile, visibleFiles} = sandpack;
const isMultiFile = visibleFiles.length > 1;
const hasJustToggledDropdown = useRef(false);

Expand Down Expand Up @@ -114,11 +108,11 @@
if (sandpack.editorState === 'dirty' && confirm('Clear all your edits?')) {
sandpack.resetAllFiles();
}
refresh();

Check failure on line 111 in src/components/MDX/Sandpack/NavigationBar.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Cannot find name 'refresh'.
};

const handleReload = () => {
refresh();

Check failure on line 115 in src/components/MDX/Sandpack/NavigationBar.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Cannot find name 'refresh'.
};

return (
Expand Down
Loading