Skip to content

Commit 96dc0be

Browse files
feat: support new unstable api in debugger
1 parent a6014cf commit 96dc0be

File tree

5 files changed

+118
-109
lines changed

5 files changed

+118
-109
lines changed

.changeset/twenty-pugs-roll.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"frames.js": patch
3+
"@frames.js/debugger": patch
4+
"@frames.js/render": patch
5+
---
6+
7+
feat: multi specification support

packages/debugger/app/components/action-debugger.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import {
77
} from "@/components/ui/hover-card";
88
import { cn } from "@/lib/utils";
99
import {
10-
type FarcasterFrameContext,
11-
type FrameActionBodyPayload,
1210
OnComposeFormActionFuncReturnType,
1311
defaultTheme,
1412
} from "@frames.js/render";
@@ -33,7 +31,6 @@ import { Button } from "../../@/components/ui/button";
3331
import { FrameDebugger } from "./frame-debugger";
3432
import IconByName from "./octicons";
3533
import { MockHubActionContext } from "../utils/mock-hub-utils";
36-
import { useFrame } from "@frames.js/render/use-frame";
3734
import { WithTooltip } from "./with-tooltip";
3835
import { useToast } from "@/components/ui/use-toast";
3936
import type { CastActionDefinitionResponse } from "../frames/route";
@@ -42,7 +39,7 @@ import { AwaitableController } from "../lib/awaitable-controller";
4239
import type { ComposerActionFormResponse } from "frames.js/types";
4340
import { CastComposer, CastComposerRef } from "./cast-composer";
4441
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
45-
import type { FarcasterSigner } from "@frames.js/render/identity/farcaster";
42+
import { useFrame } from "@frames.js/render/unstable-use-frame";
4643

4744
type FrameDebuggerFramePropertiesTableRowsProps = {
4845
actionMetadataItem: CastActionDefinitionResponse;
@@ -177,13 +174,7 @@ function ShortenedText({
177174

178175
type ActionDebuggerProps = {
179176
actionMetadataItem: CastActionDefinitionResponse;
180-
farcasterFrameConfig: Parameters<
181-
typeof useFrame<
182-
FarcasterSigner | null,
183-
FrameActionBodyPayload,
184-
FarcasterFrameContext
185-
>
186-
>[0];
177+
farcasterFrameConfig: Parameters<typeof useFrame>[0];
187178
refreshUrl: (arg0?: string) => void;
188179
mockHubContext?: Partial<MockHubActionContext>;
189180
setMockHubContext?: Dispatch<SetStateAction<Partial<MockHubActionContext>>>;

packages/debugger/app/components/cast-composer.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
ExternalLinkIcon,
1212
} from "lucide-react";
1313
import IconByName from "./octicons";
14-
import { useFrame } from "@frames.js/render/use-frame";
1514
import { WithTooltip } from "./with-tooltip";
1615
import type {
1716
FarcasterFrameContext,
@@ -23,17 +22,12 @@ import { useToast } from "@/components/ui/use-toast";
2322
import { ToastAction } from "@radix-ui/react-toast";
2423
import Link from "next/link";
2524
import type { FarcasterSigner } from "@frames.js/render/identity/farcaster";
25+
import { useFrame } from "@frames.js/render/unstable-use-frame";
2626

2727
type CastComposerProps = {
2828
composerAction: Partial<ComposerActionResponse>;
2929
onComposerActionClick: (state: ComposerActionState) => any;
30-
farcasterFrameConfig: Parameters<
31-
typeof useFrame<
32-
FarcasterSigner | null,
33-
FrameActionBodyPayload,
34-
FarcasterFrameContext
35-
>
36-
>[0];
30+
farcasterFrameConfig: Parameters<typeof useFrame>[0];
3731
};
3832

3933
export type CastComposerRef = {
@@ -119,13 +113,7 @@ export const CastComposer = React.forwardRef<
119113
CastComposer.displayName = "CastComposer";
120114

121115
type CastEmbedPreviewProps = {
122-
farcasterFrameConfig: Parameters<
123-
typeof useFrame<
124-
FarcasterSigner | null,
125-
FrameActionBodyPayload,
126-
FarcasterFrameContext
127-
>
128-
>[0];
116+
farcasterFrameConfig: Parameters<typeof useFrame>[0];
129117
url: string;
130118
onRemove: () => void;
131119
};

packages/debugger/app/components/frame-debugger.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import type { AnonymousSigner } from "@frames.js/render/identity/anonymous";
6363
import type { LensSigner } from "@frames.js/render/identity/lens";
6464
import type { FarcasterSigner } from "@frames.js/render/identity/farcaster";
6565
import type { XmtpSigner } from "@frames.js/render/identity/xmtp";
66+
import type { UseFrameReturnValue } from "@frames.js/render/unstable-use-frame";
6667

6768
type FrameDiagnosticsProps = {
6869
stackItem: FramesStackItem;
@@ -160,8 +161,8 @@ function FrameDiagnostics({ stackItem }: FrameDiagnosticsProps) {
160161
{stackItem.speed > 5
161162
? `Request took more than 5s (${stackItem.speed} seconds). This may be normal: first request will take longer in development (as next.js builds), but in production, clients will timeout requests after 5s`
162163
: stackItem.speed > 4
163-
? `Warning: Request took more than 4s (${stackItem.speed} seconds). Requests will fail at 5s. This may be normal: first request will take longer in development (as next.js builds), but in production, if there's variance here, requests could fail in production if over 5s`
164-
: `${stackItem.speed} seconds`}
164+
? `Warning: Request took more than 4s (${stackItem.speed} seconds). Requests will fail at 5s. This may be normal: first request will take longer in development (as next.js builds), but in production, if there's variance here, requests could fail in production if over 5s`
165+
: `${stackItem.speed} seconds`}
165166
</TableCell>
166167
</TableRow>
167168
{properties.validProperties.map(([propertyKey, value]) => {
@@ -282,9 +283,7 @@ const FramesRequestCardContentIcon: React.FC<{
282283

283284
const FramesRequestCardContent: React.FC<{
284285
stack: FramesStack;
285-
fetchFrame: FrameState<
286-
FarcasterSigner | XmtpSigner | LensSigner | AnonymousSigner | null
287-
>["fetchFrame"];
286+
fetchFrame: UseFrameReturnValue["fetchFrame"];
288287
}> = ({ fetchFrame, stack }) => {
289288
return stack.map((frameStackItem, i) => {
290289
return (
@@ -369,10 +368,10 @@ type FrameDebuggerSharedProps = {
369368
type FrameDebuggerProps = FrameDebuggerSharedProps &
370369
(
371370
| {
372-
useFrameHook: () => FrameState<any, any>;
371+
useFrameHook: () => UseFrameReturnValue;
373372
}
374373
| {
375-
frameState: FrameState<any, any>;
374+
frameState: UseFrameReturnValue;
376375
}
377376
);
378377

0 commit comments

Comments
 (0)