Skip to content

Commit 43e4e53

Browse files
ImriKochWixclaude
andcommitted
feat(actor): handleStart wake hook replaces user onStart overrides
Matches the platform shim: handleStart runs after credential setup, so createServiceClient is safe there and no super-call contract exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 932544b commit 43e4e53

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/actor.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ export abstract class Actor<Incoming = unknown, Outgoing = unknown> {
5555
abstract handleClose(conn: Conn<Outgoing>): void | Promise<void>;
5656
abstract handleTick(): void | Promise<void>;
5757

58-
onStart(): void | Promise<void> {}
58+
/**
59+
* Optional wake hook: runs once when the instance starts, after the
60+
* platform's credential setup and before any connection is handled — safe
61+
* to use {@link createServiceClient} and load persisted state here.
62+
*/
63+
handleStart(): void | Promise<void> {}
5964

6065
/**
6166
* Managed ticker (opt-in). Override {@link shouldTick} and the platform runs
@@ -109,7 +114,7 @@ export abstract class Actor<Incoming = unknown, Outgoing = unknown> {
109114

110115
/**
111116
* Service-role SDK client — bypasses RLS. For work with **no user in scope**
112-
* (tick, alarm, onStart). Inside handleMessage/handleConnect prefer
117+
* (tick, alarm, handleStart). Inside handleMessage/handleConnect prefer
113118
* `createClientFromConnection(conn)`.
114119
*/
115120
protected createServiceClient(): Base44Client {

0 commit comments

Comments
 (0)