From cff97596f196f78adeb9b0dfe0db32f92bfe2e2d Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Wed, 22 Feb 2023 12:26:27 +0000 Subject: [PATCH] Update index.tsx --- .../src/components/FileExplorer/index.tsx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/sandpack-react/src/components/FileExplorer/index.tsx b/sandpack-react/src/components/FileExplorer/index.tsx index d2c7192e9..01c85a809 100644 --- a/sandpack-react/src/components/FileExplorer/index.tsx +++ b/sandpack-react/src/components/FileExplorer/index.tsx @@ -1,3 +1,4 @@ +import type { SandpackBundlerFiles } from "@codesandbox/sandpack-client"; import * as React from "react"; import { useSandpack } from "../../hooks/useSandpack"; @@ -61,24 +62,32 @@ export const SandpackFileExplorer = ({ [status] ); + const orderedFiles = Object.keys(files) + .sort() + .reduce((obj, key) => { + obj[key] = files[key]; + return obj; + }, {}); + return (
- +
+ +
); };