@arbidocs/react 0.4.39 → 0.4.40

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/dist/index.cjs CHANGED
@@ -2973,7 +2973,8 @@ var CitationRendererComponent = ({
2973
2973
  useCitationState,
2974
2974
  onCloseCitation,
2975
2975
  onDismissCitation,
2976
- notify: notify2
2976
+ notify: notify2,
2977
+ docTitles
2977
2978
  }) => {
2978
2979
  const chunkMap = React.useMemo(() => {
2979
2980
  const map = /* @__PURE__ */ new Map();
@@ -2982,14 +2983,18 @@ var CitationRendererComponent = ({
2982
2983
  if (docChunks && Array.isArray(docChunks)) {
2983
2984
  docChunks.forEach((chunk) => {
2984
2985
  if (chunk.metadata && chunk.metadata.chunk_ext_id) {
2985
- map.set(chunk.metadata.chunk_ext_id, chunk);
2986
+ const displayTitle = chunk.metadata.doc_ext_id ? docTitles?.get(chunk.metadata.doc_ext_id) : void 0;
2987
+ map.set(
2988
+ chunk.metadata.chunk_ext_id,
2989
+ displayTitle ? { ...chunk, metadata: { ...chunk.metadata, doc_title: displayTitle } } : chunk
2990
+ );
2986
2991
  }
2987
2992
  });
2988
2993
  }
2989
2994
  });
2990
2995
  }
2991
2996
  return map;
2992
- }, [citationData]);
2997
+ }, [citationData, docTitles]);
2993
2998
  const getChunkDetails = React.useCallback(
2994
2999
  (chunkIds) => [...new Set(chunkIds)].map((id) => chunkMap.get(id)).filter((c) => c !== void 0),
2995
3000
  [chunkMap]