mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-19 21:00:40 +08:00
<!--
Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md
-->
<!-- RECURSEML_SUMMARY:START -->
## High-level PR Summary
This PR fixes dependency management issues by adding the missing
`wait-on` package to the Convex example's dependencies, reorganizing the
dependency order in `package.json` for consistency, and regenerating the
`pnpm-lock.yaml` file to ensure proper dependency resolution across the
monorepo.
⏱️ Estimated Review Time: 5-15 minutes
<details>
<summary>💡 Review Order Suggestion</summary>
| Order | File Path |
|-------|-----------|
| 1 | `examples/convex/package.json` |
| 2 | `pnpm-lock.yaml` |
</details>
[](https://discord.gg/n3SsVDAW6U)
[
<!-- RECURSEML_SUMMARY:END -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added UI buttons to view user info via different clients, a
server-side user info section, and an Action page to view/submit updates
to user metadata.
- Added a server-side action to update a user's client-read-only
metadata.
- **Documentation**
- In-app link and guidance to the Action route for updating user data.
- **Chores**
- Updated project dependencies/devDependencies and added .env.local to
.gitignore.
- **Bug Fixes**
- Token-missing scenario now handled gracefully instead of throwing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import Home from "./inner";
|
|
import { preloadQuery, preloadedQueryResult } from "convex/nextjs";
|
|
import { api } from "@/convex/_generated/api";
|
|
import { ConvexHttpClient } from "convex/browser";
|
|
import { stackServerApp } from "@/stack/server";
|
|
|
|
export default async function ServerPage() {
|
|
const preloaded = await preloadQuery(api.myFunctions.listNumbers, {
|
|
count: 3,
|
|
});
|
|
|
|
const data = preloadedQueryResult(preloaded);
|
|
|
|
const convex = new ConvexHttpClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
|
|
const token = await stackServerApp.getConvexHttpClientAuth({ tokenStore: "nextjs-cookie" });
|
|
convex.setAuth(token);
|
|
const userInfo = await convex.query(api.myFunctions.getUserInfo, {});
|
|
|
|
return (
|
|
<main className="p-8 flex flex-col gap-4 mx-auto max-w-2xl">
|
|
<h1 className="text-4xl font-bold text-center">Convex + Next.js</h1>
|
|
<div className="flex flex-col gap-4 bg-slate-200 dark:bg-slate-800 p-4 rounded-md">
|
|
<h2 className="text-xl font-bold">User info</h2>
|
|
<code>
|
|
<pre>{JSON.stringify(JSON.parse(userInfo), null, 2)}</pre>
|
|
</code>
|
|
</div>
|
|
<div className="flex flex-col gap-4 bg-slate-200 dark:bg-slate-800 p-4 rounded-md">
|
|
<h2 className="text-xl font-bold">Non-reactive server-loaded data</h2>
|
|
<code>
|
|
<pre>{JSON.stringify(data, null, 2)}</pre>
|
|
</code>
|
|
</div>
|
|
<Home preloaded={preloaded} />
|
|
</main>
|
|
);
|
|
}
|