create-user-hub 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-user-hub",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Start a TanStack Start + Convex app with User Hub sign-in: bun create user-hub@latest my-app",
5
5
  "type": "module",
6
6
  "bin": {
@@ -23,7 +23,14 @@ const CONVEX_URL = import.meta.env.VITE_CONVEX_URL;
23
23
  if (!CONVEX_URL) {
24
24
  throw new Error("Missing VITE_CONVEX_URL: run `bun run setup` first");
25
25
  }
26
- const convex = new ConvexReactClient(CONVEX_URL);
26
+ // expectAuth: queries wait for the person's token, so none runs signed out.
27
+ // initialAuthTokenReuse: Convex keeps that token until its refresh is due,
28
+ // instead of fetching another at once (a second sign-in that reruns every
29
+ // query).
30
+ const convex = new ConvexReactClient(CONVEX_URL, {
31
+ expectAuth: true,
32
+ initialAuthTokenReuse: true,
33
+ });
27
34
 
28
35
  // The signed-in person's token from the request, so the server renders them
29
36
  // instead of the loading state.
@@ -23,6 +23,11 @@ export default defineConfig({
23
23
  // that URL, so stop with an error when the port is taken instead of moving
24
24
  // to the next free one.
25
25
  server: { strictPort: true },
26
+ // One convex/react in the browser: the hub provider gives the Convex
27
+ // client to the same context the app's Convex hooks read. Pre-bundled
28
+ // together, so a re-optimization can never split them into two copies
29
+ // ("Could not find Convex client").
30
+ optimizeDeps: { include: ["convex/react", "@user-hub/auth/convex-react"] },
26
31
  plugins: lazyPlugins(() => [
27
32
  tailwindcss(),
28
33
  tanstackStart(),