Skip to content

Commit 2f4b47c

Browse files
committed
chore: update examples for new client
1 parent 1cb146c commit 2f4b47c

File tree

7 files changed

+7
-10
lines changed

7 files changed

+7
-10
lines changed

docs/examples/chat.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,7 @@ Add the form submit handler to your init function:
319319
320320
async function init() {
321321
// Connect to chat room with channel tag
322-
const chatRoom = await client.get({
323-
name: 'chat-room',
324-
channel, // Use channel as a tag to separate different chat rooms
325-
});
322+
const chatRoom = await client.chatRoom.getOrCreate(channel);
326323
327324
// Store reference for use in event handlers
328325
// In a production app, you'd use a more encapsulated approach

examples/chat-room/scripts/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function main() {
1010

1111
// connect to chat room - now accessed via property
1212
// can still pass parameters like room
13-
const chatRoom = client.chatRoom.get(room, {
13+
const chatRoom = client.chatRoom.getOrCreate(room, {
1414
params: { room },
1515
}).connect();
1616

examples/chat-room/scripts/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ async function main() {
77
const client = createClient<App>(process.env.ENDPOINT ?? "http://localhost:6420");
88

99
// connect to chat room - now accessed via property
10-
const chatRoom = client.chatRoom.get().connect();
10+
const chatRoom = client.chatRoom.getOrCreate().connect();
1111

1212
// call action to get existing messages
1313
const messages = await chatRoom.getHistory();

examples/chat-room/tests/chat-room.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test("chat room should handle messages", async (test) => {
66
const { client } = await setupTest(test, app);
77

88
// Connect to chat room
9-
const chatRoom = client.chatRoom.get().connect();
9+
const chatRoom = client.chatRoom.getOrCreate().connect();
1010

1111
// Initial history should be empty
1212
const initialMessages = await chatRoom.getHistory();

examples/counter/tests/counter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { app } from "../actors/app";
44

55
test("it should count", async (test) => {
66
const { client } = await setupTest(test, app);
7-
const counter = client.counter.get().connect();
7+
const counter = client.counter.getOrCreate().connect();
88

99
// Test initial count
1010
expect(await counter.getCount()).toBe(0);

examples/linear-coding-agent/src/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ server.post("/api/webhook/linear", async (c) => {
9595
// Create or get a coding agent instance with the issue ID as a key
9696
// This ensures each issue gets its own actor instance
9797
console.log(`[SERVER] Getting actor for issue: ${issueId}`);
98-
const actorClient = client.codingAgent.get(issueId).connect();
98+
const actorClient = client.codingAgent.getOrCreate(issueId).connect();
9999

100100
// Initialize the agent if needed
101101
console.log(`[SERVER] Initializing actor for issue: ${issueId}`);

examples/resend-streaks/tests/user.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ beforeEach(() => {
2626

2727
test("streak tracking with time zone signups", async (t) => {
2828
const { client } = await setupTest(t, app);
29-
const actor = client.user.get().connect();
29+
const actor = client.user.getOrCreate().connect();
3030

3131
// Sign up with specific time zone
3232
const signupResult = await actor.completeSignUp(

0 commit comments

Comments
 (0)