Fix Redis state typings for url and client options#303
Fix Redis state typings for url and client options#303haydenbleasel wants to merge 1 commit intovercel:mainfrom
Conversation
|
@haydenbleasel is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
bensabic
left a comment
There was a problem hiding this comment.
This looks good overall, but I think the injected redis client path in connect() needs one follow-up. Right now it treats client.isOpen as enough to mark the adapter connected, but in node-redis v5 isOpen only means the socket is open, not that the client is ready to accept commands. The docs distinguish this from client.isReady, and isOpen can still be true while the client is connecting or reconnecting. That means await adapter.connect() can resolve too early for createRedisState({ client }), and the first Redis command can still race startup/reconnect.
Could we gate on client.isReady or wait for the ready event in the already-open case, and add a test that covers an injected client that is open but not yet ready?
Summary
createRedisStatetypings sourlappears in IntelliSense forcreateRedisState({ url: "..." })REDIS_URLenv fallbackurlusage and existing-client usage@chat-adapter/state-redisTest plan
pnpm buildandpnpm test, both successful