@samebase/convex-auth-tanstack-start 0.1.1 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+
5
+ - `useSignOutSession` loads `landingUrl` with `location.replace`, so Back after a sign-out no longer
6
+ returns to the page of the session that ended.
7
+
3
8
  ## 0.1.1
4
9
 
5
10
  - `useSignOutSession(url, landingUrl)` loads `landingUrl` after the sign-out instead of reloading
package/README.md CHANGED
@@ -132,11 +132,11 @@ Without `next`, the gate is `redirectWithoutSession(serverContext, { to: "/signi
132
132
  `Authenticated` and `Unauthenticated` render nothing on the server.
133
133
  - `useSignOutSession(url, landingUrl)`: returns a function that posts to the app's sign-out route,
134
134
  such as `/auth/signout`, and only after a 2xx calls Convex Auth's `signOut()`, which clears the
135
- stored token in every tab, and loads `landingUrl`, such as `/`; otherwise it returns `false` and
136
- the session stays. A reload of the page the visitor signed out on would ask the server for a
137
- private page without a session, and a gate would answer with its sign-in redirect and `next`.
138
- Convex Auth's `signOut()` resolves even when the route failed, so a reload after it alone signs
139
- the user back in from the cookie.
135
+ stored token in every tab, and loads `landingUrl`, such as `/`, in place of the current history
136
+ entry; otherwise it returns `false` and the session stays. A reload of the page the visitor signed
137
+ out on would ask the server for a private page without a session, and a gate would answer with its
138
+ sign-in redirect and `next`. Convex Auth's `signOut()` resolves even when the route failed, so a
139
+ reload after it alone signs the user back in from the cookie.
140
140
 
141
141
  `@convex-dev/auth` is a peer dependency pinned to 2.0.0-beta.0, because `convexAuth()` resolves a
142
142
  file inside that version. An app on Convex Auth 0.0.x stays on
package/dist/index.d.ts CHANGED
@@ -57,7 +57,8 @@ export declare function SignedOut({ children }: {
57
57
  * other tabs (its own call to the route is then redundant), and the browser loads `landingUrl`,
58
58
  * such as `/`, with a full load, because `expectAuth` holds queries only before the first
59
59
  * authentication. Not a reload: the page the visitor signed out on is usually private, and a
60
- * request for it without a session gets the gate's sign-in redirect with `next`.
60
+ * request for it without a session gets the gate's sign-in redirect with `next`. The load replaces
61
+ * the current history entry: Back after a sign-out skips the page of the session that ended.
61
62
  */
62
63
  export declare function useSignOutSession(url: string, landingUrl: string): () => Promise<boolean>;
63
64
  /**
package/dist/index.js CHANGED
@@ -80,7 +80,8 @@ export function SignedOut({ children }) {
80
80
  * other tabs (its own call to the route is then redundant), and the browser loads `landingUrl`,
81
81
  * such as `/`, with a full load, because `expectAuth` holds queries only before the first
82
82
  * authentication. Not a reload: the page the visitor signed out on is usually private, and a
83
- * request for it without a session gets the gate's sign-in redirect with `next`.
83
+ * request for it without a session gets the gate's sign-in redirect with `next`. The load replaces
84
+ * the current history entry: Back after a sign-out skips the page of the session that ended.
84
85
  */
85
86
  export function useSignOutSession(url, landingUrl) {
86
87
  const { signOut } = useAuthActions();
@@ -89,7 +90,7 @@ export function useSignOutSession(url, landingUrl) {
89
90
  if (!response?.ok)
90
91
  return false;
91
92
  await signOut();
92
- location.assign(landingUrl);
93
+ location.replace(landingUrl);
93
94
  return true;
94
95
  };
95
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samebase/convex-auth-tanstack-start",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Convex Auth cookie sessions in TanStack Start, on any host.",
5
5
  "keywords": [
6
6
  "auth",