@teleporthq/teleport-plugin-next-workflows 0.43.49 → 0.43.50

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.
@@ -77,9 +77,28 @@ async function account_get_current(_config: unknown, context: Record<string, unk
77
77
  const liveUser = snapshot.session && snapshot.session.user ? snapshot.session.user : null
78
78
  if (liveUser) {
79
79
  __cache(liveUser)
80
+ ;(window as any).__tqSessionConfirmedSignedOut = false
80
81
  return __out(liveUser)
81
82
  }
82
83
  }
84
+ // The fetch below exists to guard against 'unauthenticated' meaning "the
85
+ // provider's fetch FAILED" rather than "signed out". Once ONE fetch this
86
+ // page load has come back ok with no user, that ambiguity is resolved —
87
+ // repeating the confirmation on every subsequent click only burns a round
88
+ // trip. The memo is a window flag (never storage): a reload starts a
89
+ // fresh page and re-verifies, and it is cleared the moment any live user
90
+ // is observed. It is consulted ONLY when next-auth itself reports
91
+ // 'unauthenticated' — it can never mask a signed-in session, and it is
92
+ // display-plumbing only: every server-side write re-derives identity
93
+ // from the httpOnly session cookie, not from anything cached here.
94
+ if (
95
+ snapshot &&
96
+ snapshot.status === 'unauthenticated' &&
97
+ (window as any).__tqSessionConfirmedSignedOut === true
98
+ ) {
99
+ __cache(null)
100
+ return __out(null)
101
+ }
83
102
  } catch (_e) {}
84
103
  }
85
104
 
@@ -91,6 +110,12 @@ async function account_get_current(_config: unknown, context: Record<string, unk
91
110
 
92
111
  __cache(user)
93
112
 
113
+ if (typeof window !== 'undefined') {
114
+ try {
115
+ ;(window as any).__tqSessionConfirmedSignedOut = !user
116
+ } catch (_e) {}
117
+ }
118
+
94
119
  return __out(user)
95
120
  }
96
121