-
Notifications
You must be signed in to change notification settings - Fork 7
Replace user ID in examples with Arcade account email (if logged in) #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
evantahler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const replacement = loading | ||
| ? "{arcade_user_id}" // Keep original while loading | ||
| : email || "{arcade_user_id}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FANCY
sdserranog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
| import { useOrySession } from "@/lib/OrySessionContext"; | ||
| import { getCookie } from "@/lib/utils"; | ||
|
|
||
| export function PlaceholderReplacer() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change this now, but for the future. This approach can be a bit expensive. It searches every single text element on the page to find the placeholder and then mutates the DOM after the page has loaded.
We could improve this later in a couple of ways:
- Create a dedicated component to show the examples that consumes our OryContextProvider. So we can search/replace the placeholder only in the example.
- Use a Server Component to read the cookie and replace the placeholder on the server, which would prevent any client-side DOM mutation for the initial load.
| useEffect(() => { | ||
| const checkSession = async () => { | ||
| try { | ||
| const { data: session } = await ory.toSession(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can also use a server component here to avoid a loading state

To make the quickstart and code examples easier to follow, this PR replaces all sample user IDs like
[email protected]with a placeholder with either:"{arcade_user_id"}if notThis change will help reduce confusion especially when #341 is merged.