Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

bug fixed

daniel31x135d26617251fd
diff --git a/hooks/store/links.tsx b/hooks/store/links.tsx
index 4702ff41..f8a2c751 100644
--- a/hooks/store/links.tsx
+++ b/hooks/store/links.tsx
@@ -398,14 +398,13 @@ const useBulkEditLinks = () => {
return data.response;
},
onSuccess: (data, { links, newData, removePreviousTags }) => {
- queryClient.setQueryData(["dashboardData"], (oldData: any) => {
- if (!oldData) return undefined;
- return oldData.map((e: any) =>
- data.find((d: any) => d.id === e.id) ? data : e
- );
- });
-
- // TODO: Fix this
+ // TODO: Fix these
+ // queryClient.setQueryData(["dashboardData"], (oldData: any) => {
+ // if (!oldData) return undefined;
+ // return oldData.map((e: any) =>
+ // data.find((d: any) => d.id === e.id) ? data : e
+ // );
+ // });
// queryClient.setQueriesData({ queryKey: ["links"] }, (oldData: any) => {
// if (!oldData) return undefined;
// return {
@@ -417,6 +416,7 @@ const useBulkEditLinks = () => {
// };
// });
queryClient.invalidateQueries({ queryKey: ["links"] }); // Temporary workaround
+ queryClient.invalidateQueries({ queryKey: ["dashboardData"] }); // Temporary workaround
queryClient.invalidateQueries({ queryKey: ["collections"] });
queryClient.invalidateQueries({ queryKey: ["tags"] });
diff --git a/lib/client/getPublicCollectionData.ts b/lib/client/getPublicCollectionData.ts
index a8a74a33..c87abd1f 100644
--- a/lib/client/getPublicCollectionData.ts
+++ b/lib/client/getPublicCollectionData.ts
@@ -1,12 +1,4 @@
-import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
-import { Dispatch, SetStateAction } from "react";
-
-const getPublicCollectionData = async (
- collectionId: number,
- setData: Dispatch<
- SetStateAction<CollectionIncludingMembersAndLinkCount | undefined>
- >
-) => {
+const getPublicCollectionData = async (collectionId: number) => {
const res = await fetch("/api/v1/public/collections/" + collectionId);
if (res.status === 400)
@@ -14,8 +6,6 @@ const getPublicCollectionData = async (
const data = await res.json();
- setData(data.response);
-
return data;
};
diff --git a/pages/public/collections/[id].tsx b/pages/public/collections/[id].tsx
index ab7fd426..53efbb3e 100644
--- a/pages/public/collections/[id].tsx
+++ b/pages/public/collections/[id].tsx
@@ -19,7 +19,6 @@ import EditCollectionSharingModal from "@/components/ModalContent/EditCollection
import { useTranslation } from "next-i18next";
import getServerSideProps from "@/lib/client/getServerSideProps";
import LinkListOptions from "@/components/LinkListOptions";
-import { useCollections } from "@/hooks/store/collections";
import { usePublicLinks } from "@/hooks/store/publicLinks";
import Links from "@/components/LinkViews/Links";
@@ -28,8 +27,6 @@ export default function PublicCollections() {
const { settings } = useLocalSettingsStore();
- const { data: collections = [] } = useCollections();
-
const router = useRouter();
const [collectionOwner, setCollectionOwner] = useState({
@@ -71,25 +68,22 @@ export default function PublicCollections() {
useEffect(() => {
if (router.query.id) {
- getPublicCollectionData(Number(router.query.id), setCollection).then(
- (res) => {
- if (res.status === 400) {
- router.push("/dashboard");
- }
+ getPublicCollectionData(Number(router.query.id)).then((res) => {
+ if (res.status === 400) {
+ router.push("/dashboard");
+ } else {
+ setCollection(res.response);
}
- );
+ });
}
- }, [collections]);
+ }, []);
useEffect(() => {
- const fetchOwner = async () => {
- if (collection) {
- const owner = await getPublicUserData(collection.ownerId as number);
- setCollectionOwner(owner);
- }
- };
-
- fetchOwner();
+ if (collection) {
+ getPublicUserData(collection.ownerId as number).then((owner) =>
+ setCollectionOwner(owner)
+ );
+ }
}, [collection]);
const [editCollectionSharingModal, setEditCollectionSharingModal] =
@@ -236,9 +230,7 @@ export default function PublicCollections() {
placeholderCount={1}
useData={data}
/>
- {!data.isLoading && links && !links[0] && (
- <p>{t("collection_is_empty")}</p>
- )}
+ {!data.isLoading && links && !links[0] && <p>{t("nothing_found")}</p>}
{/* <p className="text-center text-neutral">
List created with <span className="text-black">Linkwarden.</span>