| ... | @@ -15,6 +15,11 @@ import { | ... | @@ -15,6 +15,11 @@ import { |
| 15 | import { getRenderablePatch, resolveFileDiffPath, type RenderablePatch } from "~/lib/diffRendering"; | 15 | import { getRenderablePatch, resolveFileDiffPath, type RenderablePatch } from "~/lib/diffRendering"; |
| 16 | import { reviewEnvironment } from "~/state/review"; | 16 | import { reviewEnvironment } from "~/state/review"; |
| 17 | | 17 | |
| | 18 | const filePathCollator = new Intl.Collator(undefined, { |
| | 19 | numeric: true, |
| | 20 | sensitivity: "base", |
| | 21 | }); |
| | 22 | |
| 18 | export function useReviewFilePatches({ | 23 | export function useReviewFilePatches({ |
| 19 | environmentId, | 24 | environmentId, |
| 20 | cwd, | 25 | cwd, |
| ... | @@ -49,10 +54,7 @@ export function useReviewFilePatches({ | ... | @@ -49,10 +54,7 @@ export function useReviewFilePatches({ |
| 49 | [requested, scope], | 54 | [requested, scope], |
| 50 | ); | 55 | ); |
| 51 | const files = useMemo( | 56 | const files = useMemo( |
| 52 | () => | 57 | () => source?.files?.toSorted((a, b) => filePathCollator.compare(a.path, b.path)) ?? [], |
| 53 | source?.files?.toSorted((a, b) => | | |
| 54 | a.path.localeCompare(b.path, undefined, { numeric: true, sensitivity: "base" }), | | |
| 55 | ) ?? [], | | |
| 56 | [source?.files], | 58 | [source?.files], |
| 57 | ); | 59 | ); |
| 58 | const queries = useMemo( | 60 | const queries = useMemo( |
| ... | @@ -191,10 +193,7 @@ export function useReviewFilePatches({ | ... | @@ -191,10 +193,7 @@ export function useReviewFilePatches({ |
| 191 | }; | 193 | }; |
| 192 | }) | 194 | }) |
| 193 | : (preview?.kind === "files" ? preview.files : []).toSorted((a, b) => | 195 | : (preview?.kind === "files" ? preview.files : []).toSorted((a, b) => |
| 194 | resolveFileDiffPath(a).localeCompare(resolveFileDiffPath(b), undefined, { | 196 | filePathCollator.compare(resolveFileDiffPath(a), resolveFileDiffPath(b)), |
| 195 | numeric: true, | | |
| 196 | sensitivity: "base", | | |
| 197 | }), | | |
| 198 | ), | 197 | ), |
| 199 | [source, files, patches, scope, preview], | 198 | [source, files, patches, scope, preview], |
| 200 | ); | 199 | ); |