Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tidy-client-cookie-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/shared': patch
---

Clarify that `ClientResource.cookieExpiresAt` is nullable, can change when Clerk refreshes the client cookie, and reflects the cookie Device Trust uses to recognize a browser.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Describe cookieExpiresAt as an expiration time.

The implementation stores cookieExpiresAt as Date | null. The phrase “reflects the cookie” can imply that the property contains the cookie itself. State that it represents the current expiration time of the client authentication cookie used by Device Trust to recognize a known browser.

Proposed wording
-Clarify that `ClientResource.cookieExpiresAt` is nullable, can change when Clerk refreshes the client cookie, and reflects the cookie Device Trust uses to recognize a browser.
+Clarify that `ClientResource.cookieExpiresAt` is nullable, can change when Clerk refreshes the client cookie, and represents the current expiration time of the client authentication cookie used by Device Trust to recognize a known browser.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Clarify that `ClientResource.cookieExpiresAt` is nullable, can change when Clerk refreshes the client cookie, and reflects the cookie Device Trust uses to recognize a browser.
Clarify that `ClientResource.cookieExpiresAt` is nullable, can change when Clerk refreshes the client cookie, and represents the current expiration time of the client authentication cookie used by Device Trust to recognize a known browser.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/tidy-client-cookie-docs.md at line 5, Update the documentation
for ClientResource.cookieExpiresAt to describe it as the current expiration time
of the client authentication cookie used by Device Trust to recognize a known
browser. Explicitly state that it is nullable and may change when Clerk
refreshes the client cookie, without implying that the property contains the
cookie itself.

5 changes: 4 additions & 1 deletion packages/shared/src/types/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ export interface ClientResource extends ClerkResource {
*/
captchaBypass: boolean;
/**
* The date and time when the client's authentication cookie will expire.
* The date and time when the client authentication cookie is currently set to expire. Clerk can refresh this
* cookie, so the value can change. Returns `null` when the expiration is unavailable.
*
* [Device Trust](https://clerk.com/docs/guides/secure/device-trust) uses the client cookie to recognize a known browser.
*/
cookieExpiresAt: Date | null;
/**
Expand Down
Loading