0.9.9 release lifecycle types

Hey just upgraded to 0.9.9 a few minutes ago, OnCreateOptions & CreateStateOptionstypes seem to be missing from the actors pkg exports. I had some helpful factory pattens setup using these types, are they still available?
17 Replies
nicolas-angelo
nicolas-angeloOP4mo ago
cc @Nathan
Nathan
Nathan4mo ago
input was moved to a top-level parameter to make type inference easier so there are no more opts rn
nicolas-angelo
nicolas-angeloOP4mo ago
oh gotcha, can you send me link to docs or code file on github where I can see this visually?
Nathan
Nathan4mo ago
the diff or docs?
nicolas-angelo
nicolas-angeloOP4mo ago
yea sorry haha the diff might be more helpful
nicolas-angelo
nicolas-angeloOP4mo ago
@Nathan got it now so both input & params are seperated from options
Nathan
Nathan4mo ago
yep. used to be really hard to write types so rivetkit would infer it before
nicolas-angelo
nicolas-angeloOP4mo ago
is options completely eradicated or is it just a separated from input and params?
Nathan
Nathan4mo ago
just separated – they'll be added back if there are options actually i'm realizing that i should add empty options to both for forwards compat
nicolas-angelo
nicolas-angeloOP4mo ago
because the d.ts files are showing that options is part of the lifecycle args for onBeforeConnect and createConnectionState
Nathan
Nathan4mo ago
this is what they were before
No description
Nathan
Nathan4mo ago
ie they were empty so got removed. but there likely will be more there in the future that's correct. you can access request in onbeforeconnect and createconnectionstate.
nicolas-angelo
nicolas-angeloOP4mo ago
so for ex (i've modularized my hooks): export function createConnState( c: AnyActorContext, opts: OnConnectOptions, params: Params ) {} export async function onBeforeConnect( c: ChatActorContext, opts: OnConnectOptions, params: Params ) {} the .d.ts file shows that opts exists and comes before params in both cases. Just wanted to make sure this is true more speficially want to make sure that params is always the 3rd arg and not the 2nd if opts is undefined
Nathan
Nathan4mo ago
we're in typescript so the dts should always be correct. if there's something that's not right then lmk and i'll fix up the tests yep correct.
nicolas-angelo
nicolas-angeloOP4mo ago
ok cool just updated my hooks, going to test now got everything working ! no issues i can see so far

Did you find this page helpful?