Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.

Commit 67cccb0

Browse files
committed
docs(skills): guard both useAuth members in the auth-permissions example
The `useAuth` fence under "useAuth hook" read `user.name` behind an `isAuthenticated`-only guard. `AuthProvider` hardcodes `isAuthenticated` to `true` in guest mode and in preview mode while `user` stays `null`, so the example threw a TypeError in exactly the two modes a reader without an auth backend is in. Guard both members the way the shipped `UserMenu` does, and add one sentence beside the fence saying why a signed-in-looking context can still carry no user. The fence stays unmarked: it is a fragment by construction (three undeclared placeholders), and marking it would red the gate for reasons that are not this defect. Claude-Session: https://claude.ai/code/session_01DAcomhvR9kKizeYgg89Vo8 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 69aa9c0 commit 67cccb0

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
---
3+
4+
Guard both `isAuthenticated` and `user` in the `useAuth` example of
5+
`skills/objectui/guides/auth-permissions.md`, and say why beside it
6+
(objectui#9350). Published skills guidance only; no package is released by
7+
this change.

‎skills/objectui/guides/auth-permissions.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ function App() {
3535

3636
### useAuth hook
3737

38+
Guard `user` on its own, not through `isAuthenticated`: in guest mode (`enabled: false`) and in preview mode, `AuthProvider` hardcodes `isAuthenticated` to `true` while `user` stays `null`, so a signed-in-looking context can still carry no user. The shipped `UserMenu` guards both members the same way.
39+
3840
```typescript
3941
import { useAuth } from '@object-ui/auth';
4042

4143
function UserBadge() {
4244
const { user, isAuthenticated, isLoading, error, signOut } = useAuth();
4345

4446
if (isLoading) return <Spinner />;
45-
if (!isAuthenticated) return <LoginButton />;
47+
if (!isAuthenticated || !user) return <LoginButton />;
4648

4749
return (
4850
<div>

0 commit comments

Comments
 (0)