Skip to content

Commit d187be1

Browse files
skeptrunedevcdxker
authored andcommitted
cleanup(search): add validation to prevent fetching bookmarks without chunk metadata and dataset
1 parent 2e23bbb commit d187be1

3 files changed

Lines changed: 3 additions & 0 deletions

File tree

frontends/search/src/components/BookmarkPopover.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ const BookmarkPopover = (props: BookmarkPopoverProps) => {
215215
const refetchBookmarks = (curPage: number) => {
216216
const currentDataset = $dataset?.();
217217
if (!currentDataset) return;
218+
if (!props.chunkMetadata.id) return;
218219

219220
void fetch(`${apiHost}/chunk_group/chunks`, {
220221
method: "POST",

frontends/search/src/components/EditChunkPageForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const EditChunkPageForm = (props: SingleChunkPageProps) => {
8484
createEffect(() => {
8585
const currentDatasetId = $dataset?.()?.dataset.id;
8686
if (!currentDatasetId) return;
87+
if (!props.chunkId) return;
8788

8889
void fetch(`${apiHost}/chunk_group/chunks`, {
8990
method: "POST",

frontends/search/src/components/ResultsPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ const ResultsPage = (props: ResultsPageProps) => {
183183
const fetchBookmarks = () => {
184184
const dataset = $dataset?.();
185185
if (!dataset) return;
186+
if (resultChunks().length === 0) return;
186187

187188
void fetch(`${apiHost}/chunk_group/chunks`, {
188189
method: "POST",

0 commit comments

Comments
 (0)