Spaces:
Running
Running
fix commit parameter
Browse files
components/editor/commits.tsx
CHANGED
|
@@ -12,8 +12,6 @@ import {
|
|
| 12 |
import { Commit } from "@/lib/type";
|
| 13 |
import { cn, humanizeNumber } from "@/lib/utils";
|
| 14 |
|
| 15 |
-
// todo: when there is a commit query, highlight the selected commit in the list.
|
| 16 |
-
|
| 17 |
export const Commits = function ({ commits }: { commits?: Commit[] }) {
|
| 18 |
const searchParams = useSearchParams();
|
| 19 |
const commitParam = searchParams.get("commit");
|
|
@@ -58,7 +56,7 @@ export const Commits = function ({ commits }: { commits?: Commit[] }) {
|
|
| 58 |
}, [open]);
|
| 59 |
|
| 60 |
useUpdateEffect(() => {
|
| 61 |
-
if (selectedCommit !== commits?.[0].oid) {
|
| 62 |
setSelectedCommit(commits ? commits[0]?.oid : null);
|
| 63 |
}
|
| 64 |
}, [commits]);
|
|
|
|
| 12 |
import { Commit } from "@/lib/type";
|
| 13 |
import { cn, humanizeNumber } from "@/lib/utils";
|
| 14 |
|
|
|
|
|
|
|
| 15 |
export const Commits = function ({ commits }: { commits?: Commit[] }) {
|
| 16 |
const searchParams = useSearchParams();
|
| 17 |
const commitParam = searchParams.get("commit");
|
|
|
|
| 56 |
}, [open]);
|
| 57 |
|
| 58 |
useUpdateEffect(() => {
|
| 59 |
+
if (selectedCommit !== commits?.[0].oid && !commitParam) {
|
| 60 |
setSelectedCommit(commits ? commits[0]?.oid : null);
|
| 61 |
}
|
| 62 |
}, [commits]);
|