@proveanything/smartlinks-utils-ui 0.9.8 → 0.9.10
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.
|
@@ -737,26 +737,15 @@ var useFacetBrowse = ({
|
|
|
737
737
|
enabled: queryEnabled,
|
|
738
738
|
staleTime: 3e4,
|
|
739
739
|
queryFn: async () => {
|
|
740
|
-
const t0 = performance.now();
|
|
741
740
|
try {
|
|
742
741
|
if (SL?.facets?.list) {
|
|
743
|
-
console.info(`${LOG} \u2192 SL.facets.list("${collectionId}", { includeValues: true })`);
|
|
744
742
|
const res = await SL.facets.list(collectionId, { includeValues: true });
|
|
745
743
|
const items = res?.items ?? [];
|
|
746
|
-
console.info(
|
|
747
|
-
`${LOG} \u2190 SL.facets.list ok in ${Math.round(performance.now() - t0)}ms \u2014 ${items.length} facet(s)`,
|
|
748
|
-
items
|
|
749
|
-
);
|
|
750
744
|
return items;
|
|
751
745
|
}
|
|
752
746
|
if (SL?.facets?.publicList) {
|
|
753
|
-
console.info(`${LOG} \u2192 SL.facets.publicList("${collectionId}", { includeValues: true })`);
|
|
754
747
|
const res = await SL.facets.publicList(collectionId, { includeValues: true });
|
|
755
748
|
const items = res?.items ?? [];
|
|
756
|
-
console.info(
|
|
757
|
-
`${LOG} \u2190 SL.facets.publicList ok in ${Math.round(performance.now() - t0)}ms \u2014 ${items.length} facet(s)`,
|
|
758
|
-
items
|
|
759
|
-
);
|
|
760
749
|
return items;
|
|
761
750
|
}
|
|
762
751
|
console.warn(`${LOG} queryFn ran but no facets API is available on SL`);
|
|
@@ -773,7 +762,6 @@ var useFacetBrowse = ({
|
|
|
773
762
|
if (signature === lastLoggedRef.current) return;
|
|
774
763
|
lastLoggedRef.current = signature;
|
|
775
764
|
if (!enabled) {
|
|
776
|
-
console.info(`${LOG} skipped \u2014 enabled=false (shell not on facet tab yet)`);
|
|
777
765
|
return;
|
|
778
766
|
}
|
|
779
767
|
if (!collectionId) {
|
|
@@ -787,9 +775,6 @@ var useFacetBrowse = ({
|
|
|
787
775
|
);
|
|
788
776
|
return;
|
|
789
777
|
}
|
|
790
|
-
console.info(
|
|
791
|
-
`${LOG} will fetch facets for collection "${collectionId}" via ${hasAdminList ? "SL.facets.list (admin)" : "SL.facets.publicList (fallback)"}`
|
|
792
|
-
);
|
|
793
778
|
}, [enabled, collectionId, hasAdminList, hasPublicList, hasAnyList, SL]);
|
|
794
779
|
const mergedItems = useMemo(() => {
|
|
795
780
|
const existingByAnchor = new Map(
|
|
@@ -2123,6 +2108,17 @@ var useShellDeepLink = (args) => {
|
|
|
2123
2108
|
const [pendingDeepLinkRecordId, setPendingDeepLinkRecordId] = useState(null);
|
|
2124
2109
|
const preserveInitialRecordIdRef = useRef(!!deepLinkState.urlState.recordId);
|
|
2125
2110
|
const warnedMissingRef = useRef(/* @__PURE__ */ new Set());
|
|
2111
|
+
const bootLoggedRef = useRef(false);
|
|
2112
|
+
if (!bootLoggedRef.current) {
|
|
2113
|
+
bootLoggedRef.current = true;
|
|
2114
|
+
console.info("[RecordsAdminShell] deep-link boot snapshot", {
|
|
2115
|
+
enabled: deepLinkState.enabled,
|
|
2116
|
+
urlState: deepLinkState.urlState,
|
|
2117
|
+
paramNames: deepLinkState.paramNames,
|
|
2118
|
+
windowHash: typeof window !== "undefined" ? window.location.hash : null,
|
|
2119
|
+
windowSearch: typeof window !== "undefined" ? window.location.search : null
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2126
2122
|
useEffect(() => {
|
|
2127
2123
|
if (!deepLinkState.enabled) return;
|
|
2128
2124
|
if (selectedItemId) return;
|
|
@@ -2164,6 +2160,13 @@ var useShellDeepLink = (args) => {
|
|
|
2164
2160
|
}
|
|
2165
2161
|
setPendingDeepLinkRecordId(recordId ?? null);
|
|
2166
2162
|
if (recordId) preserveInitialRecordIdRef.current = true;
|
|
2163
|
+
if (recordId) {
|
|
2164
|
+
console.info("[RecordsAdminShell] deep-link restore \u2014 pending recordId set", {
|
|
2165
|
+
recordId,
|
|
2166
|
+
scope: scope ?? null,
|
|
2167
|
+
view: view ?? null
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2167
2170
|
if (!recordId && selectedItemId !== null) {
|
|
2168
2171
|
console.info("[RecordsAdminShell] preserving selected item during restore without recordId", {
|
|
2169
2172
|
selectedItemId,
|
|
@@ -2189,7 +2192,9 @@ var useShellDeepLink = (args) => {
|
|
|
2189
2192
|
warnedMissingRef.current.add(pending);
|
|
2190
2193
|
console.warn("[RecordsAdminShell] deep-linked recordId not found in collection items \u2014 clearing pending selection", {
|
|
2191
2194
|
recordId: pending,
|
|
2192
|
-
scope: editingScope?.raw ?? null
|
|
2195
|
+
scope: editingScope?.raw ?? null,
|
|
2196
|
+
collectionItemsCount: collectionItems.items.length,
|
|
2197
|
+
sampleIds: collectionItems.items.slice(0, 5).map((it) => ({ id: it.id, itemId: it.itemId }))
|
|
2193
2198
|
});
|
|
2194
2199
|
}
|
|
2195
2200
|
preserveInitialRecordIdRef.current = false;
|
|
@@ -2209,7 +2214,10 @@ var useShellDeepLink = (args) => {
|
|
|
2209
2214
|
warnedMissingRef.current.add(pending);
|
|
2210
2215
|
console.warn("[RecordsAdminShell] deep-linked recordId not found in records list \u2014 clearing pending selection", {
|
|
2211
2216
|
recordId: pending,
|
|
2212
|
-
scope: editingScope?.raw ?? null
|
|
2217
|
+
scope: editingScope?.raw ?? null,
|
|
2218
|
+
recordListCount: recordListItems.length,
|
|
2219
|
+
sampleIds: recordListItems.slice(0, 5).map((it) => it.id),
|
|
2220
|
+
activeScopeHint: "check that the shell tab matches the record's scope"
|
|
2213
2221
|
});
|
|
2214
2222
|
}
|
|
2215
2223
|
preserveInitialRecordIdRef.current = false;
|