@the-portland-company/shell 0.100.0 → 0.101.1

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,20 @@
1
+ ## 0.101.1
2
+
3
+ The user card's re-read after a profile change asks for a fresh profile (follow-up to 0.101.0, live check 2026-11-14).
4
+
5
+ - **Cause.** The chrome API (Contacts) keeps each profile row for 15 s. Politogy ID writes a new photo or name straight to VRM Core, so the re-read that 0.101.0 fires right after the save could still get the old photo when the page had read `me` in the last 15 s. Seen live: the card kept the old photo until the event fired again later.
6
+ - **Fix.** On `politogy:profile-changed` the provider reads `me?fresh=1`, and the chrome API drops its cached copy of the caller's own profile before answering (politogy-contacts, `GET /api/me?fresh=1`). An API without the flag answers a normal read.
7
+ - Tests: `__tests__/profileChanged.test.tsx` checks the re-read path.
8
+
9
+ ## 0.101.0
10
+
11
+ 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").
12
+
13
+ - **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.
14
+ - **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.
15
+ - New exports on `./native`: `announceProfileChanged()` (fires the event) and `PROFILE_CHANGED_EVENT`.
16
+ - Tests: `__tests__/profileChanged.test.tsx` (new).
17
+
1
18
  ## 0.100.0
2
19
 
3
20
  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,28 @@ 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 = (fresh = false) => {
814
+ const call = ++latest;
815
+ const read = fresh ? fetchJsonRef.current("me?fresh=1", void 0) : dedupedFetch("me", void 0);
816
+ read.then((data) => {
817
+ if (!cancelled && call === latest) setMe(data);
818
+ }).catch(() => {
819
+ }).finally(() => {
820
+ if (!cancelled) setMeLoaded(true);
821
+ });
822
+ };
823
+ load();
824
+ const onProfileChanged = () => {
825
+ invalidateChromeCache("me");
826
+ load(true);
827
+ };
828
+ window.addEventListener(PROFILE_CHANGED_EVENT, onProfileChanged);
818
829
  return () => {
819
830
  cancelled = true;
831
+ window.removeEventListener(PROFILE_CHANGED_EVENT, onProfileChanged);
820
832
  };
821
- }, [dedupedFetch]);
833
+ }, [dedupedFetch, invalidateChromeCache]);
822
834
  return /* @__PURE__ */ jsxRuntime.jsx(
823
835
  NavChromeContext.Provider,
824
836
  {
@@ -827,6 +839,7 @@ function NavChromeProvider({
827
839
  }
828
840
  );
829
841
  }
842
+ var PROFILE_CHANGED_EVENT = "politogy:profile-changed";
830
843
  function useChromeMe() {
831
844
  const ctx = react.useContext(NavChromeContext);
832
845
  return { me: ctx?.me ?? null, loaded: ctx?.meLoaded ?? false };