Skip to content

Commit

Permalink
cleanup: support bubble up on collections page and fix solidjs reacti…
Browse files Browse the repository at this point in the history
…vity issue
  • Loading branch information
skeptrunedev committed Oct 2, 2023
1 parent 13f0044 commit 9ee87d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions search/src/components/BookmarkPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ const BookmarkPopover = (props: BookmarkPopoverProps) => {
}

const cardBookmarks = bookmarks();
refetchCollections(curPage, cardBookmarks);
const setCardCollections = props.setCardCollections;
refetchCollections(curPage, cardBookmarks, setCardCollections);

return curPage;
}, 1);
Expand All @@ -86,7 +87,8 @@ const BookmarkPopover = (props: BookmarkPopoverProps) => {

const curPage = localCollectionPage();
const cardBookmarks = bookmarks();
refetchCollections(curPage, cardBookmarks);
const setCardCollections = props.setCardCollections;
refetchCollections(curPage, cardBookmarks, setCardCollections);
setRefetchingCardCollections(false);
});

Expand All @@ -106,6 +108,7 @@ const BookmarkPopover = (props: BookmarkPopoverProps) => {
const refetchCollections = (
curPage: number,
cardBookmarks: CardBookmarksDTO[],
setCardCollections: Setter<CardCollectionDTO[]>,
) => {
void fetch(`${apiHost}/card_collection/${localCollectionPage()}`, {
method: "GET",
Expand Down Expand Up @@ -149,7 +152,7 @@ const BookmarkPopover = (props: BookmarkPopoverProps) => {

const updatedCollections = [...collectionsToAdd, ...deDupedPrev];
setLocalCardCollections(updatedCollections);
props.setCardCollections(updatedCollections);
setCardCollections(updatedCollections);
}
});
}
Expand Down Expand Up @@ -254,7 +257,7 @@ const BookmarkPopover = (props: BookmarkPopoverProps) => {
Manage Collections For This Card
</div>
<MenuItem as="button" aria-label="Empty" />
<div class="scrollbar-track-rounded-md scrollbar-thumb-rounded-md max-w-screen mx-1 max-h-[20vh] transform justify-end space-y-2 overflow-y-auto rounded px-4 scrollbar-thin scrollbar-track-neutral-200 scrollbar-thumb-neutral-600 dark:scrollbar-track-neutral-700 dark:scrollbar-thumb-neutral-400">
<div class="max-w-screen mx-1 max-h-[20vh] transform justify-end space-y-2 overflow-y-auto rounded px-4 scrollbar-thin scrollbar-track-neutral-200 scrollbar-thumb-neutral-600 scrollbar-track-rounded-md scrollbar-thumb-rounded-md dark:scrollbar-track-neutral-700 dark:scrollbar-thumb-neutral-400">
<For each={localCardCollections()}>
{(collection, idx) => {
return (
Expand Down
1 change: 1 addition & 0 deletions search/src/components/CollectionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ export const CollectionPage = (props: CollectionPageProps) => {
setOnDelete={setOnDelete}
setShowConfirmModal={setShowConfirmDeleteModal}
showExpand={clientSideRequestFinished()}
setCardCollections={setCardCollections}
/>
</div>
)}
Expand Down

0 comments on commit 9ee87d8

Please sign in to comment.