Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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: 3 additions & 7 deletions src/app/entity/[slug]/ProcessInteraction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { MonoFontFF } from "@/components/RootLayout/fonts"
import { prettifyResult } from "@/utils/ao-utils"
import { truncateId } from "@/utils/data-utils"

import { RequestHistoryPanel, dryRunHistoryStore } from "@/components/RequestHistoryPanel"
import { RequestHistoryPanel, dryRunHistoryStore, addToDryRunHistory } from "@/components/RequestHistoryPanel"

type ProcessInteractionProps = {
processId: string
Expand Down Expand Up @@ -58,9 +58,7 @@ export function ProcessInteraction(props: ProcessInteractionProps) {
timestamp: new Date().toISOString(),
}

const existing = dryRunHistoryStore.get() || []
const updated = [...existing, newItem].slice(-10)
dryRunHistoryStore.set(updated)
addToDryRunHistory(newItem)
} else {
const sentMsgId = await message({
...msg,
Expand All @@ -78,9 +76,7 @@ export function ProcessInteraction(props: ProcessInteractionProps) {
sentMessageId: sentMsgId,
}

const existing = dryRunHistoryStore.get() || []
const updated = [...existing.slice(-9), newItem]
dryRunHistoryStore.set(updated)
addToDryRunHistory(newItem)
}

setResponse(JSON.stringify(prettifyResult(json), null, 2))
Expand Down
2 changes: 1 addition & 1 deletion src/components/AsyncTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export function AsyncTable(props: AsyncTableProps) {
</TableRow>
</TableHead>
<TableBody>
{virtualize && data.length > pageSize * 3 ? (
{virtualize && data.length > pageSize * 100 ? (
<VirtualRows
data={data}
rowRenderer={renderRow}
Expand Down
14 changes: 13 additions & 1 deletion src/components/RequestHistoryPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ export const dryRunHistoryStore = persistentAtom<any[]>(
{ encode: JSON.stringify, decode: JSON.parse },
)

const MAX_HISTORY = 5;

export function addToDryRunHistory(newItem: any) {
const prev = dryRunHistoryStore.get() || [];
const updated = [...prev, newItem];
if (updated.length > MAX_HISTORY) {
updated.splice(0, updated.length - MAX_HISTORY); // Remove oldest
}
dryRunHistoryStore.set(updated);
}

const ChevronDownIcon = () => (
<svg width="24" height="24" fill="none" viewBox="0 0 24 24" style={{ display: "block" }}>
<path
Expand All @@ -45,7 +56,8 @@ const CodeEditor = lazy(() => import("./CodeEditor").then(m=>({default:m.CodeEdi

export function RequestHistoryPanel({ onSelect }: RequestHistoryPanelProps) {
const address = useActiveAddress()
const history = useStore(dryRunHistoryStore)
const rawHistory = useStore(dryRunHistoryStore)
const history = Array.isArray(rawHistory) ? rawHistory : []
const [expanded, setExpanded] = useState<string | false>(false)
const [hoveredId, setHoveredId] = useState<string | null>(null)

Expand Down