docs: fix Unstorage session driver examples - #14409
Conversation
Replace invalid `tls` config with `ttl`, type the Redis driver config as `RedisOptions`, and adapt unstorage drivers to Astro's `SessionDriver` interface so the snippets typecheck. Fixes withastro#14339
|
Hello! Thank you for opening your first PR to Astro’s Docs! 🎉 Here’s what will happen next:
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
ArmandPhilippot
left a comment
There was a problem hiding this comment.
Thanks, I left two suggestions: a nit and something that should be reworded.
I also note that using AI is fine, but you are still required to adhere to the repository's conventions and contribution guidelines.
- You did not use our PR template
- Writing "English docs only (src/content/docs/en/…). Code sample changes should be translated." is AI slop. This is not helpful for maintainers. This is expected for any contributors.
| entrypoint: 'unstorage/drivers/redis', | ||
| config: { | ||
| tls: true | ||
| // Options are forwarded to the unstorage Redis driver (see its RedisOptions type) |
There was a problem hiding this comment.
nit: Because we can't have a link here, I think the parentheses is not useful:
| // Options are forwarded to the unstorage Redis driver (see its RedisOptions type) | |
| // Options are forwarded to the unstorage Redis driver |
| ``` | ||
|
|
||
| Alternatively, you can import and use an unstorage driver directly in the implementation. For example: | ||
| Alternatively, you can import an unstorage driver in the implementation and adapt it to Astro's `SessionDriver` interface. For example: |
There was a problem hiding this comment.
The page doesn't explicitly says what is the SessionDriver type. So, I think we should reword this a bit and add a link to the section where we describe the expected methods. Something like:
| Alternatively, you can import an unstorage driver in the implementation and adapt it to Astro's `SessionDriver` interface. For example: | |
| Alternatively, you can import an unstorage driver and [implement a session driver](#the-session-driver-implementation) by wrapping the available methods. For example: |
|
Preview deployment ✅ Deployment complete!
|
Changes
Fixes #14339
Per maintainer guidance on that issue:
tlsexample option withttlconfigparameter asRedisOptionsSessionDriverinterface in the "Alternatively" / sessions guide examples so the snippets typecheckAlso softens the claim that Unstorage driver types are directly compatible with
SessionDriver, since that is what caused the TypeScript errors.Notes
src/content/docs/en/…). Code sample changes should be translated.SessionDrivertype alignment is tracked upstream: Properly infer available driver methods unjs/unstorage#805