Skip to content

Commit f9eccbd

Browse files
thomasballingerConvex, Inc.
authored andcommitted
Preserve auth in React Query integration for actions during SSR (#38198)
Not preserving actions during auth was an accident. GitOrigin-RevId: f203776d8a6f98e0de8044b09144b7b3903a6ada
1 parent 104029d commit f9eccbd

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@convex-dev/react-query",
3-
"version": "0.0.0-alpha.8",
3+
"version": "0.0.0-alpha.9",
44
"license": "Apache-2.0",
55
"type": "module",
66
"scripts": {

src/index.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,7 @@ export class ConvexQueryClient {
139139
);
140140
}
141141
if (isServer) {
142-
this.serverHttpClient = new ConvexHttpClient(
143-
// TODO use .url once [email protected] is released
144-
(this.convexClient as any).address as string,
145-
);
142+
this.serverHttpClient = new ConvexHttpClient(this.convexClient.url);
146143
}
147144
}
148145
/** Complete initialization of ConvexQueryClient by connecting a TanStack QueryClient */
@@ -332,15 +329,9 @@ export class ConvexQueryClient {
332329
if (isConvexAction(context.queryKey)) {
333330
const [_, func, args] = context.queryKey;
334331
if (isServer) {
335-
const client = new ConvexHttpClient(
336-
// TODO expose this private property
337-
(this.convexClient as any).address as string,
338-
);
339-
const data = await client.action(func, args);
340-
return data;
332+
return await this.convexClient.action(func, args);
341333
} else {
342-
const data = await this.convexClient.action(func, args);
343-
return data;
334+
return await this.convexClient.action(func, args);
344335
}
345336
}
346337
return otherFetch(context);

0 commit comments

Comments
 (0)