Skip to content
Open
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
1 change: 0 additions & 1 deletion content/platform/authentication/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ if (error) {
}

console.log('User created:', user.id);

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.

🟣 Pre-existing: Sign-up examples read user.id although the SDK docs say sign-up returns no user

content/sdk/js/authentication.md:47 says signUp() without signInWhenAllowed: true returns no user and no session. Yet content/platform/authentication/quickstart.md:38-48 and content/platform/databases/quick-start.md:51-56 call signUp() without that option and then read user.id. A reader following either quickstart gets a TypeError on a null user. Line 51 of the auth quickstart also says the response "includes the user object and a session with tokens". This PR doesn't cause the problem (the removed session.access_token line would have thrown too), but these blocks are the ones it edits. Fix: pass signInWhenAllowed: true or add an explicit signIn step, and correct the response description.

Found by claude-opus-5-5

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.

🟣 Pre-existing: Signup examples assume the default response contains a user

content/sdk/js/authentication.md documents that signup returns no user or session by default. This example and content/platform/databases/quick-start.md:51–56 omit signInWhenAllowed yet read user.id, causing a TypeError after successful signup. Show a sign-in step before accessing the user and correct the response description. This inconsistency already exists in the base.

Found by gpt-6.1-sol

console.log('Access token:', session.access_token);
```

The response includes the user object and a session with tokens:
Expand Down
1 change: 0 additions & 1 deletion content/platform/authentication/volcano-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ if (error) {
window.location.href = '/login';
} else {
// Session refreshed, new tokens stored automatically
console.log('New access token:', session.access_token);
}
```

Expand Down
2 changes: 0 additions & 2 deletions content/platform/databases/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const { user, session } = await volcano.auth.signUp({
});

console.log('User ID:', user.id); // This is what auth.uid() returns in database
console.log('Access token:', session.access_token); // Automatically used for queries

// Or sign in existing user
await volcano.auth.signIn({
Expand Down Expand Up @@ -217,7 +216,6 @@ const response = await fetch('https://api.yourapp.com/auth/signup', {

const { access_token, user } = await response.json();
console.log('User ID:', user.id);
console.log('Access Token:', access_token);
// Save access_token for database queries!
```

Expand Down
3 changes: 0 additions & 3 deletions content/sdk/js/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,10 @@ if (AuthRefreshDiscardedError.is(error)) {
// Auth state changed while this request was pending. Read the current state
// or ask the user to retry; do not automatically replay a mutation.
const { data } = await volcano.auth.getSession();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With the console.log lines gone, the three error-handling examples still run const { data } = await volcano.auth.getSession(); but never use data. The examples now fetch the session and throw it away, so they no longer show readers what "read the current state" or "treat the current session as authoritative" means. The code still works. Suggested change: Use the session without exposing tokens. For example, log data.session?.user?.id, or add a comment such as // update UI from data.session. Either way the destructured value does something and no token is printed."}]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After removing the two console.log('Current session:', data.session) lines and the 'Another auth operation established:' one, each branch still runs const { data } = await volcano.auth.getSession(); but never uses data. The example now shows a call whose result is discarded, which reads as dead code to someone copying it. Same cosmetic residue applies to the now-unused session variable in authentication/quickstart.md line 38, volcano-sdk.md line 319, and databases/quick-start.md line 51. Suggested change: Either drop the destructuring (await volcano.auth.getSession(); with a comment such as // Re-read the current session before deciding what to show) or use the result without printing the token, for example: const { data } = await volcano.auth.getSession(); if (!data.session) { /* redirect to login */ }

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.

⚪ P3: Error-handling examples now fetch the session and discard it

With the log lines removed, all three branches (lines 140, 144, 167) still run const { data } = await volcano.auth.getSession(); but never read data. The prose around them says to "read the current state" and "treat the current session as authoritative". The examples no longer show what that means, and a reader copying them gets an unused variable. Fix: use the session without printing tokens, for example if (!data.session) { /* redirect to sign-in */ } or log data.session?.user?.id. The same leftover appears in content/platform/authentication/quickstart.md:38, content/platform/authentication/volcano-sdk.md:319 and content/platform/databases/quick-start.md:51, where session is still destructured but unused.

Found by claude-opus-5-5

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.

⚪ P3: Concurrency recovery examples discard the session they read

All three recovery branches now fetch data without using it, leaving the examples without a concrete step demonstrating the surrounding guidance to use the current session. Add an application-state update or an explanatory placeholder using data.session.

Found by gpt-6.1-sol

console.log('Current session:', data.session);
} else if (AuthSessionChangedError.is(error)) {
// The user response belongs to a session that was replaced while the
// request was pending.
const { data } = await volcano.auth.getSession();
console.log('Current session:', data.session);
} else if (error) {
console.error('Unable to load the user:', error.message);
} else {
Expand All @@ -167,7 +165,6 @@ const { user, error } = await volcano.auth.signIn({

if (AuthSessionChangedError.is(error)) {
const { data } = await volcano.auth.getSession();
console.log('Another auth operation established:', data.session);
} else if (error) {
console.error('Sign-in failed:', error.message);
} else {
Expand Down