@the-portland-company/shell 0.100.0 → 0.101.0

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,3 +1,12 @@
1
+ ## 0.101.0
2
+
3
+ A new photo or name saved on My Profile shows in the left-bar user card at once (bug seen live 2026-11-14, Ben: "updating profile picture from My Profile does not immediately display in the personal information footer").
4
+
5
+ - **Cause.** `NavChromeProvider` read `me` (the user's name and photo) once per page and kept it. My Profile saved the new photo and updated its own preview, but nothing told the chrome, so the card kept the old photo until a reload.
6
+ - **Fix.** The provider now reads `me` again when the page fires the `politogy:profile-changed` window event, skipping the read cache. Only the newest read lands, and a failed re-read keeps the last good identity.
7
+ - New exports on `./native`: `announceProfileChanged()` (fires the event) and `PROFILE_CHANGED_EVENT`.
8
+ - Tests: `__tests__/profileChanged.test.tsx` (new).
9
+
1
10
  ## 0.100.0
2
11
 
3
12
  New pages open at the top (Ben 2026-11-08, clicked "Save as written" and "Go, all Modes" in the scroll-to-top session box; Reference/UI-Platform → URL state → "Scroll position"). Ben: "when clicking from one tab to another … the next page starts out slightly scrolled down. I need every new page to start fully scrolled at the top."
@@ -809,16 +809,27 @@ function NavChromeProvider({
809
809
  const [meLoaded, setMeLoaded] = react.useState(false);
810
810
  react.useEffect(() => {
811
811
  let cancelled = false;
812
- dedupedFetch("me", void 0).then((data) => {
813
- if (!cancelled) setMe(data);
814
- }).catch(() => {
815
- }).finally(() => {
816
- if (!cancelled) setMeLoaded(true);
817
- });
812
+ let latest = 0;
813
+ const load = () => {
814
+ const call = ++latest;
815
+ dedupedFetch("me", void 0).then((data) => {
816
+ if (!cancelled && call === latest) setMe(data);
817
+ }).catch(() => {
818
+ }).finally(() => {
819
+ if (!cancelled) setMeLoaded(true);
820
+ });
821
+ };
822
+ load();
823
+ const onProfileChanged = () => {
824
+ invalidateChromeCache("me");
825
+ load();
826
+ };
827
+ window.addEventListener(PROFILE_CHANGED_EVENT, onProfileChanged);
818
828
  return () => {
819
829
  cancelled = true;
830
+ window.removeEventListener(PROFILE_CHANGED_EVENT, onProfileChanged);
820
831
  };
821
- }, [dedupedFetch]);
832
+ }, [dedupedFetch, invalidateChromeCache]);
822
833
  return /* @__PURE__ */ jsxRuntime.jsx(
823
834
  NavChromeContext.Provider,
824
835
  {
@@ -827,6 +838,7 @@ function NavChromeProvider({
827
838
  }
828
839
  );
829
840
  }
841
+ var PROFILE_CHANGED_EVENT = "politogy:profile-changed";
830
842
  function useChromeMe() {
831
843
  const ctx = react.useContext(NavChromeContext);
832
844
  return { me: ctx?.me ?? null, loaded: ctx?.meLoaded ?? false };