Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit e12f879

Browse files
committed
chore(core): update createRivetKit to accept a client options (#1392)
1 parent 27f4b41 commit e12f879

File tree

18 files changed

+59
-63
lines changed

18 files changed

+59
-63
lines changed

examples/ai-agent/src/frontend/App.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useEffect, useState } from "react";
33
import type { Message, registry } from "../backend/registry";
44

5-
const client = createClient<typeof registry>("http://localhost:8080");
6-
const { useActor } = createRivetKit(client);
5+
const { useActor } = createRivetKit<typeof registry>("http://localhost:8080");
76

87
export function App() {
98
const aiAgent = useActor({
@@ -77,4 +76,4 @@ export function App() {
7776
</div>
7877
</div>
7978
);
80-
}
79+
}

examples/better-auth-external-db/src/frontend/components/ChatRoom.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useEffect, useState } from "react";
33
import type { registry } from "../../backend/registry";
44
import { authClient } from "../auth-client";
55

6-
const client = createClient<typeof registry>("http://localhost:8080");
7-
8-
const { useActor } = createRivetKit(client);
6+
const { useActor } = createRivetKit<typeof registry>("http://localhost:8080");
97

108
interface ChatRoomProps {
119
user: { id: string; email: string };

examples/chat-room/src/frontend/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useEffect, useState } from "react";
33
import type { Message, registry } from "../backend/registry";
44

5-
const client = createClient<typeof registry>("http://localhost:6420");
6-
const { useActor } = createRivetKit(client);
5+
const { useActor } = createRivetKit<typeof registry>("http://localhost:6420");
76

87
export function App() {
98
const [roomId, setRoomId] = useState("general");

examples/crdt/src/frontend/App.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useEffect, useRef, useState } from "react";
33
import * as Y from "yjs";
44
import { applyUpdate, encodeStateAsUpdate } from "yjs";
55
import type { registry } from "../backend/registry";
66

7-
const client = createClient<typeof registry>("http://localhost:8080");
8-
const { useActor } = createRivetKit(client);
7+
const { useActor } = createRivetKit<typeof registry>("http://localhost:8080");
98

109
function YjsEditor({ documentId }: { documentId: string }) {
1110
const yjsDocument = useActor({
@@ -192,4 +191,4 @@ function bufferToBase64(buffer: Uint8Array): string {
192191
binary += String.fromCharCode(buffer[i]);
193192
}
194193
return btoa(binary);
195-
}
194+
}

examples/database/src/frontend/App.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useEffect, useState } from "react";
33
import type { Note, registry } from "../backend/registry";
44

5-
const client = createClient<typeof registry>("http://localhost:8080");
6-
const { useActor } = createRivetKit(client);
5+
const { useActor } = createRivetKit<typeof registry>("http://localhost:8080");
76

87
function NotesApp({ userId }: { userId: string }) {
98
const [notes, setNotes] = useState<Note[]>([]);
@@ -199,4 +198,4 @@ export function App() {
199198
<NotesApp key={selectedUser} userId={selectedUser} />
200199
</div>
201200
);
202-
}
201+
}

examples/freestyle/src/frontend/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useEffect, useState } from "react";
33
import type { Message, registry } from "../backend/registry";
44

5-
const client = createClient<typeof registry>({
5+
const { useActor } = createRivetKit<typeof registry>({
66
endpoint: import.meta.env.VITE_RIVET_ENDPOINT ?? "http://localhost:8080/api",
77
namespace: import.meta.env.VITE_RIVET_NAMESPACE,
88
runnerName: import.meta.env.VITE_RIVET_RUNNER_NAME ?? "freestyle-runner",
99
});
10-
const { useActor } = createRivetKit(client);
1110

1211
export function App() {
1312
const [roomId, setRoomId] = useState("general");

examples/game/src/frontend/App.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useEffect, useRef, useState } from "react";
33
import type { Player, registry } from "../backend/registry";
44

5-
const client = createClient<typeof registry>("http://localhost:8080");
6-
const { useActor } = createRivetKit(client);
5+
const { useActor } = createRivetKit<typeof registry>("http://localhost:8080");
76

87
export function App() {
98
const [players, setPlayers] = useState<Player[]>([]);
@@ -200,4 +199,4 @@ export function App() {
200199
</div>
201200
</div>
202201
);
203-
}
202+
}

examples/hono-bun/src/frontend/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useState } from "react";
33
import type { registry } from "../backend/registry";
44

5-
const client = createClient<typeof registry>("http://localhost:8080/rivet");
6-
const { useActor } = createRivetKit<typeof registry>(client);
5+
const { useActor } = createRivetKit<typeof registry>("http://localhost:8080/rivet");
76

87
function App() {
98
const [count, setCount] = useState(0);

examples/hono-react/src/frontend/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { createClient, createRivetKit } from "@rivetkit/react";
1+
import { createRivetKit } from "@rivetkit/react";
22
import { useState } from "react";
33
import type { registry } from "../backend/registry";
44

5-
const client = createClient<typeof registry>("http://localhost:8080");
6-
const { useActor } = createRivetKit<typeof registry>(client);
5+
const { useActor } = createRivetKit<typeof registry>("http://localhost:8080");
76

87
function App() {
98
const [count, setCount] = useState(0);

examples/next-js/src/components/Counter.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
"use client";
2+
3+
import { createRivetKit } from "@rivetkit/next-js/client";
4+
import type { registry } from "@/rivet/registry";
25
import { useState } from "react";
3-
import { useActor } from "@/lib/rivet-client";
46
import styles from "./Counter.module.css";
57

8+
export const { useActor } = createRivetKit<typeof registry>(
9+
process.env.NEXT_RIVET_ENDPOINT ?? "http://localhost:3000/api/rivet",
10+
);
11+
612
export function Counter() {
713
const [count, setCount] = useState(0);
814
const [counterName, setCounterName] = useState("test-counter");

0 commit comments

Comments
 (0)