@7365admin1/layer-common 4.7.0 → 4.7.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,5 +1,22 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fcb2938: Fix the context switcher showing a tick against two sites at once.
8
+
9
+ Not a comparison bug: `selected === item.value` was true for both rows because
10
+ both rows were the same site. The seven service apps build this list from
11
+ `customer-sites` with `value: i.site`, and a customer-sites row is an ENGAGEMENT,
12
+ not a site — one site can carry more than one. Production has two active rows for
13
+ the same site, identical except for a stale `name` snapshot.
14
+
15
+ The switcher now offers each destination once. First occurrence wins, so the
16
+ surviving label is the current one rather than the stale snapshot. Items with no
17
+ `value` are kept — they cannot collide, and dropping them would hide a malformed
18
+ row.
19
+
3
20
  ## 4.7.0
4
21
 
5
22
  ### Minor Changes
@@ -931,11 +948,11 @@
931
948
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
932
949
  own rule from two endpoints the console already calls, unprojected:
933
950
 
934
- GET /api/members/user/:user/app/admin the Seven365 staff membership
935
- GET /api/roles/id/:role that membership's role document
951
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
952
+ GET /api/roles/id/:role that membership's role document
936
953
 
937
- owner = member.type === "admin" && role.type === "admin" && role.default === true
938
- staff = member.type === "admin" && role.type === "admin"
954
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
955
+ staff = member.type === "admin" && role.type === "admin"
939
956
 
940
957
  `role.default` is the marker because it is the only property of a platform
941
958
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -52,7 +52,7 @@
52
52
  <v-list-item
53
53
  density="compact"
54
54
  class="switch-context__row"
55
- v-for="item in prop.items"
55
+ v-for="item in uniqueItems"
56
56
  :key="item.value"
57
57
  @click="selectItem(item.value)"
58
58
  >
@@ -158,8 +158,52 @@ const search = defineModel<string>("search", {
158
158
 
159
159
  const emit = defineEmits(["search", "select", "manage", "add"]);
160
160
 
161
+ /**
162
+ * ONE ROW PER DESTINATION.
163
+ *
164
+ * Owner report, 2026-09-10: the site switcher showed a tick against TWO sites at
165
+ * once. It was not a comparison bug — `selected === item.value` is a strict
166
+ * equality and it was true for both rows, because BOTH ROWS WERE THE SAME SITE.
167
+ *
168
+ * The seven service applications all build this list from `customer-sites`,
169
+ * mapping `value: i.site`. A `customer-sites` row is an ENGAGEMENT, not a site,
170
+ * and one site can carry more than one — measured on production, provider org
171
+ * `69251bc6…` has two active rows for site `6923d666…`, identical in `site`,
172
+ * `siteOrg`, `org` and `status`, differing only in a stale `name` snapshot
173
+ * ("Seventh Condominium" from the older row, "NCC" from the newer). So the same
174
+ * site was listed twice and, being selected, was ticked twice.
175
+ *
176
+ * Picking either row sets the SAME `siteId`, so the two entries were
177
+ * indistinguishable in effect — the list offered a choice that was not a choice.
178
+ *
179
+ * Deduplicating belongs here rather than in seven layouts: this component's
180
+ * whole contract is "pick ONE of these", so two entries that do the same thing
181
+ * are its problem to reject. It also means a duplicate arriving from any other
182
+ * caller is handled without waiting for that caller to notice.
183
+ *
184
+ * FIRST OCCURRENCE WINS, deliberately. The applications receive these rows
185
+ * newest-first, so the surviving label is the current one — "NCC", which is what
186
+ * the breadcrumb already resolves from the site itself. Keeping the last would
187
+ * show the stale snapshot beside a breadcrumb that disagreed with it.
188
+ *
189
+ * An item with no `value` is left alone: it cannot collide, and silently
190
+ * dropping it would hide a malformed row instead of showing it.
191
+ */
192
+ const uniqueItems = computed(() => {
193
+ const items = Array.isArray(prop.items) ? prop.items : [];
194
+ const seen = new Set<unknown>();
195
+
196
+ return items.filter((item) => {
197
+ const value = item?.value;
198
+ if (value === undefined || value === null || value === "") return true;
199
+ if (seen.has(value)) return false;
200
+ seen.add(value);
201
+ return true;
202
+ });
203
+ });
204
+
161
205
  const name = computed(() => {
162
- return prop.items.find((item) => item.value === selected.value)?.text ?? "";
206
+ return uniqueItems.value.find((item) => item.value === selected.value)?.text ?? "";
163
207
  });
164
208
 
165
209
  /**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.7.0",
5
+ "version": "4.7.1",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",