@the-portland-company/shell 0.76.11 → 0.76.12

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.
@@ -5052,6 +5052,24 @@ function TokenChromeStateProvider({
5052
5052
  react.useEffect(() => {
5053
5053
  if (isOrgId(tokenOrg.orgId) && !pendingOrg) writeActiveOrgCookie(tokenOrg.orgId);
5054
5054
  }, [tokenOrg.orgId, pendingOrg]);
5055
+ react.useEffect(() => {
5056
+ const onWake = () => {
5057
+ const cookieOrg = readActiveOrgCookie();
5058
+ const current = tokenOrgRef.current;
5059
+ if (!isOrgId(cookieOrg) || cookieOrg === (current.orgId ?? null)) return;
5060
+ if (pendingOrg === cookieOrg) return;
5061
+ void Promise.resolve(current.onReexchange(cookieOrg, { perTab: false })).catch(
5062
+ () => {
5063
+ }
5064
+ );
5065
+ };
5066
+ window.addEventListener("focus", onWake);
5067
+ document.addEventListener("visibilitychange", onWake);
5068
+ return () => {
5069
+ window.removeEventListener("focus", onWake);
5070
+ document.removeEventListener("visibilitychange", onWake);
5071
+ };
5072
+ }, [pendingOrg]);
5055
5073
  const value = react.useMemo(
5056
5074
  () => ({
5057
5075
  orgId,