@the-portland-company/shell 0.76.8 → 0.76.9

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.
@@ -4964,9 +4964,15 @@ function TokenChromeStateProvider({
4964
4964
  })),
4965
4965
  [tokenOrg.orgs, fetchedOrgs]
4966
4966
  );
4967
- const [urlSelector] = react.useState(
4967
+ const [urlSelector, setUrlSelector] = react.useState(
4968
4968
  () => typeof window === "undefined" ? null : readOrgSelectorFromUrl(window.location.search)
4969
4969
  );
4970
+ react.useEffect(() => {
4971
+ if (typeof window === "undefined") return;
4972
+ const onLocationChange = () => setUrlSelector(readOrgSelectorFromUrl(window.location.search));
4973
+ window.addEventListener("popstate", onLocationChange);
4974
+ return () => window.removeEventListener("popstate", onLocationChange);
4975
+ }, []);
4970
4976
  const overrideOrg = react.useMemo(
4971
4977
  () => urlSelector ? matchOrgSelector(urlSelector, orgs)?.id ?? null : null,
4972
4978
  [urlSelector, orgs]
@@ -4992,6 +4998,7 @@ function TokenChromeStateProvider({
4992
4998
  void (async () => {
4993
4999
  try {
4994
5000
  const claims = await switchActiveOrg(id, { authBaseUrl: current.authBaseUrl });
5001
+ setUrlSelector(null);
4995
5002
  try {
4996
5003
  const url = new URL(window.location.href);
4997
5004
  url.searchParams.delete(ACTIVE_ORG_QUERY_PARAM);