diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index deb8a29..fe0b02e 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -146,7 +146,7 @@ function App() {
setAppHistory([
{
type: "ai_create",
- parent: null,
+ parentIndex: null,
code,
inputs: { image_url: referenceImages[0] },
},
@@ -166,7 +166,7 @@ function App() {
...prev,
{
type: "ai_edit",
- parent: parentVersion,
+ parentIndex: parentVersion,
code,
inputs: {
prompt: updateInstruction,
diff --git a/frontend/src/components/history/HistoryDisplay.tsx b/frontend/src/components/history/HistoryDisplay.tsx
index beb78a2..767319b 100644
--- a/frontend/src/components/history/HistoryDisplay.tsx
+++ b/frontend/src/components/history/HistoryDisplay.tsx
@@ -54,9 +54,9 @@ export default function HistoryDisplay({
>
{displayHistoryItemType(item.type)}
- {item.parent && item.parent !== index - 1 ? (
+ {item.parentIndex && item.parentIndex !== index - 1 ? (
- (parent: v{(item.parent || 0) + 1})
+ (parent: v{(item.parentIndex || 0) + 1})
) : null}
diff --git a/frontend/src/components/history/utils.test.ts b/frontend/src/components/history/utils.test.ts
index 2f0a34e..c434f9b 100644
--- a/frontend/src/components/history/utils.test.ts
+++ b/frontend/src/components/history/utils.test.ts
@@ -1,26 +1,27 @@
import { expect, test } from "vitest";
import { extractHistoryTree } from "./utils";
+import type { History } from "../../history_types";
-const data = [
+const data: History = [
{
- type: "ai_create" as const,
- parent: null,
+ type: "ai_create",
+ parentIndex: null,
code: "1. create",
inputs: {
image_url: "",
},
},
{
- type: "ai_edit" as const,
- parent: 0,
+ type: "ai_edit",
+ parentIndex: 0,
code: "2. edit with better icons",
inputs: {
prompt: "use better icons",
},
},
{
- type: "ai_edit" as const,
- parent: 1,
+ type: "ai_edit",
+ parentIndex: 1,
code: "3. edit with better icons and red text",
inputs: {
prompt: "make text red",
diff --git a/frontend/src/history_types.ts b/frontend/src/history_types.ts
index 4826595..55ca3f4 100644
--- a/frontend/src/history_types.ts
+++ b/frontend/src/history_types.ts
@@ -1,7 +1,7 @@
export type HistoryItemType = "ai_create" | "ai_edit";
type CommonHistoryItem = {
- parent: null | number;
+ parentIndex: null | number;
code: string;
};