⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
improved readable view
daniel31x13db9ea8eef467
diff --git a/apps/web/components/LinkDetails.tsx b/apps/web/components/LinkDetails.tsxindex de6ed673..7b0ed57f 100644--- a/apps/web/components/LinkDetails.tsx+++ b/apps/web/components/LinkDetails.tsx@@ -13,11 +13,7 @@ import getPublicUserData from "@/lib/client/getPublicUserData";import { useTranslation } from "next-i18next";import { BeatLoader } from "react-spinners";import { useUser } from "@linkwarden/router/user";-import {- useGetLink,- useUpdateLink,- useUpdateFile,-} from "@linkwarden/router/links";+import { useUpdateLink, useUpdateFile } from "@linkwarden/router/links";import LinkIcon from "./LinkViews/LinkComponents/LinkIcon";import CopyButton from "./CopyButton";import { useRouter } from "next/router";@@ -73,8 +69,6 @@ export default function LinkDetails({const isPublicRoute = router.pathname.startsWith("/public") ? true : false;- const getLink = useGetLink(isPublicRoute);-const [collectionOwner, setCollectionOwner] = useState({id: null as unknown as number,name: "",@@ -118,34 +112,6 @@ export default function LinkDetails({);};- useEffect(() => {- (async () => {- await getLink.mutateAsync({- id: link.id as number,- });- })();-- let interval: any;-- if (!isReady()) {- interval = setInterval(async () => {- await getLink.mutateAsync({- id: link.id as number,- });- }, 5000);- } else {- if (interval) {- clearInterval(interval);- }- }-- return () => {- if (interval) {- clearInterval(interval);- }- };- }, [link.monolith]);-const updateLink = useUpdateLink();const updateFile = useUpdateFile();diff --git a/apps/web/components/LinkViews/LinkComponents/LinkActions.tsx b/apps/web/components/LinkViews/LinkComponents/LinkActions.tsxindex b67f910b..ddf764bd 100644--- a/apps/web/components/LinkViews/LinkComponents/LinkActions.tsx+++ b/apps/web/components/LinkViews/LinkComponents/LinkActions.tsx@@ -45,7 +45,10 @@ export default function LinkActions({const isPublicRoute = router.pathname.startsWith("/public");- const getLink = useGetLink(isPublicRoute);+ const { refetch } = useGetLink({+ id: link.id as number,+ isPublicRoute,+ });const pinLink = usePinLink();@@ -65,7 +68,9 @@ export default function LinkActions({toast.dismiss(load);if (response.ok) {- await getLink.mutateAsync({ id: link.id as number });+ refetch().catch((error) => {+ console.error("Error fetching link:", error);+ });toast.success(t("link_being_archived"));} else toast.error(data.response);diff --git a/apps/web/components/LinkViews/LinkComponents/LinkCard.tsx b/apps/web/components/LinkViews/LinkComponents/LinkCard.tsxindex be059bbb..2ff2d7a9 100644--- a/apps/web/components/LinkViews/LinkComponents/LinkCard.tsx+++ b/apps/web/components/LinkViews/LinkComponents/LinkCard.tsx@@ -71,7 +71,7 @@ export default function LinkCard({ link, columns, editMode }: Props) {const router = useRouter();const isPublicRoute = router.pathname.startsWith("/public") ? true : false;- const getLink = useGetLink(isPublicRoute);+ const { refetch } = useGetLink({ id: link.id as number, isPublicRoute });useEffect(() => {if (!editMode) {@@ -129,8 +129,8 @@ export default function LinkCard({ link, columns, editMode }: Props) {link.preview !== "unavailable") {interval = setInterval(async () => {- getLink.mutateAsync({- id: link.id as number,+ refetch().catch((error) => {+ console.error("Error refetching link:", error);});}, 5000);}diff --git a/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx b/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsxindex 5960b84a..9a6431ea 100644--- a/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx+++ b/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx@@ -70,9 +70,9 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {const router = useRouter();- let isPublic = router.pathname.startsWith("/public") ? true : undefined;+ let isPublicRoute = router.pathname.startsWith("/public") ? true : undefined;- const getLink = useGetLink(isPublic);+ const { refetch } = useGetLink({ id: link.id as number, isPublicRoute });useEffect(() => {if (!editMode) {@@ -128,7 +128,9 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {link.preview !== "unavailable") {interval = setInterval(async () => {- getLink.mutateAsync({ id: link.id as number });+ refetch().catch((error) => {+ console.error("Error refetching link:", error);+ });}, 5000);}@@ -248,7 +250,7 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {<hr className="divider mt-2 mb-1 last:hidden border-t border-neutral-content h-[1px]" /><div className="flex flex-wrap justify-between items-center text-xs text-neutral px-3 pb-1 w-full gap-x-2">- {!isPublic && show.collection && (+ {!isPublicRoute && show.collection && (<div className="cursor-pointer truncate"><LinkCollection link={link} collection={collection} /></div>@@ -268,7 +270,7 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {setLinkModal={(e) => setLinkModal(e)}className="absolute top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100 text-neutral z-20"/>- {!isPublic && <LinkPin link={link} />}+ {!isPublicRoute && <LinkPin link={link} />}</div>);}diff --git a/apps/web/components/ModalContent/DeleteLinkModal.tsx b/apps/web/components/ModalContent/DeleteLinkModal.tsxindex 67067023..04f6a647 100644--- a/apps/web/components/ModalContent/DeleteLinkModal.tsx+++ b/apps/web/components/ModalContent/DeleteLinkModal.tsx@@ -34,7 +34,10 @@ export default function DeleteLinkModal({ onClose, activeLink }: Props) {if (error) {toast.error(error.message);} else {- if (router.pathname.startsWith("/links/[id]")) {+ if (+ router.pathname.startsWith("/links/[id]") ||+ router.pathname.startsWith("/preserved/[id]")+ ) {router.push("/dashboard");}toast.success(t("deleted"));diff --git a/apps/web/components/Preservation/PreservationContent.tsx b/apps/web/components/Preservation/PreservationContent.tsxindex 3e186bfe..411fe81f 100644--- a/apps/web/components/Preservation/PreservationContent.tsx+++ b/apps/web/components/Preservation/PreservationContent.tsx@@ -93,12 +93,12 @@ export const PreservationContent: React.FC<Props> = ({ link, format }) => {return (<>{!monolithLoaded && (- <PreservationSkeleton className="max-w-screen-lg h-screen" />+ <PreservationSkeleton className="max-w-screen-lg h-[calc(100vh-3rem)]" />)}<iframesrc={`/api/v1/archives/${link.id}?format=${ArchivedFormat.monolith}&_=${link.updatedAt}`}className={clsx(- "w-full border-none h-screen",+ "w-full border-none h-[calc(100vh-3rem)]",monolithLoaded ? "block" : "hidden")}onLoad={() => setMonolithLoaded(true)}@@ -110,12 +110,12 @@ export const PreservationContent: React.FC<Props> = ({ link, format }) => {return (<>{!pdfLoaded && (- <PreservationSkeleton className="max-w-screen-lg h-screen" />+ <PreservationSkeleton className="max-w-screen-lg h-[calc(100vh-3rem)]" />)}<iframesrc={`/api/v1/archives/${link.id}?format=${ArchivedFormat.pdf}&_=${link.updatedAt}`}className={clsx(- "w-full border-none h-screen",+ "w-full border-none h-[calc(100vh-3rem)]",pdfLoaded ? "block" : "hidden")}onLoad={() => setPdfLoaded(true)}@@ -128,12 +128,12 @@ export const PreservationContent: React.FC<Props> = ({ link, format }) => {return (<>{!imageLoaded && (- <PreservationSkeleton className="max-w-screen-lg h-screen" />+ <PreservationSkeleton className="max-w-screen-lg h-[calc(100vh-3rem)]" />)}<divclassName={clsx("overflow-auto flex items-start",- imageLoaded && "h-screen"+ imageLoaded && "h-[calc(100vh-3rem)]")}><img@@ -165,7 +165,6 @@ export const PreservationContent: React.FC<Props> = ({ link, format }) => {return (<div className="relative bg-base-200">- <PreservationNavbar link={link} format={format} />{!atLeastOneFormatAvailable(link) ? (<div className={`w-full h-full flex flex-col justify-center p-10`}><BeatLoaderdiff --git a/apps/web/components/Preservation/PreservationNavbar.tsx b/apps/web/components/Preservation/PreservationNavbar.tsxindex 31dc91d0..7f023802 100644--- a/apps/web/components/Preservation/PreservationNavbar.tsx+++ b/apps/web/components/Preservation/PreservationNavbar.tsx@@ -46,127 +46,119 @@ const PreservationNavbar = ({ link, format }: Props) => {const { t } = useTranslation();const router = useRouter();- function handleTabChange(newIndex: number) {- router.push(- {- pathname: router.pathname,- query: { ...router.query, format: newIndex },- },- undefined,- { shallow: true }- );- }-return (- <div className="max-w-5xl mx-auto py-5 flex gap-2 justify-between">- <Button variant="ghost" size="icon" asChild>- <Link href={`/dashboard`}>- <i className="bi-chevron-left text-xl" />- </Link>- </Button>- <DropdownMenu>- <DropdownMenuTrigger>- <Button variant="ghost" className="h-8">- {format === ArchivedFormat.readability- ? t("readable")- : format === ArchivedFormat.monolith- ? t("webpage")- : format === ArchivedFormat.pdf- ? t("pdf")- : t("screenshot")}- <i className="bi-chevron-down" />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent>- {formatAvailable(link, "readable") && (- <DropdownMenuCheckboxItem- onSelect={() =>- router.push(- {- query: {- ...router.query,- format: ArchivedFormat.readability,+ <div className="p-2 z-10 bg-base-100 backdrop-blur bg-opacity-80 shadow">+ <div className="max-w-5xl flex gap-2 justify-between mx-auto">+ <Button variant="ghost" size="icon" asChild>+ <Link href={`/dashboard`}>+ <i className="bi-chevron-left text-xl" />+ </Link>+ </Button>+ <DropdownMenu>+ <DropdownMenuTrigger>+ <Button variant="ghost" className="h-8">+ {format === ArchivedFormat.readability+ ? t("readable")+ : format === ArchivedFormat.monolith+ ? t("webpage")+ : format === ArchivedFormat.pdf+ ? t("pdf")+ : t("screenshot")}+ <i className="bi-chevron-down" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ {formatAvailable(link, "readable") && (+ <DropdownMenuCheckboxItem+ onSelect={() =>+ router.push(+ {+ query: {+ ...router.query,+ format: ArchivedFormat.readability,+ },},- },- undefined,- { shallow: true }- )- }- checked={format === ArchivedFormat.readability}- >- {t("readable")}- </DropdownMenuCheckboxItem>- )}- {formatAvailable(link, "monolith") && (- <DropdownMenuCheckboxItem- onSelect={() =>- router.push(- {- query: {- ...router.query,- format: ArchivedFormat.monolith,+ undefined,+ { shallow: true }+ )+ }+ checked={format === ArchivedFormat.readability}+ >+ {t("readable")}+ </DropdownMenuCheckboxItem>+ )}+ {formatAvailable(link, "monolith") && (+ <DropdownMenuCheckboxItem+ onSelect={() =>+ router.push(+ {+ query: {+ ...router.query,+ format: ArchivedFormat.monolith,+ },},- },- undefined,- { shallow: true }- )- }- checked={format === ArchivedFormat.monolith}- >- {t("webpage")}- </DropdownMenuCheckboxItem>- )}- {formatAvailable(link, "image") && (- <DropdownMenuCheckboxItem- onSelect={() =>- router.push(- {- query: {- ...router.query,- format: link?.image?.endsWith(".png")- ? ArchivedFormat.png- : ArchivedFormat.jpeg,+ undefined,+ { shallow: true }+ )+ }+ checked={format === ArchivedFormat.monolith}+ >+ {t("webpage")}+ </DropdownMenuCheckboxItem>+ )}+ {formatAvailable(link, "image") && (+ <DropdownMenuCheckboxItem+ onSelect={() =>+ router.push(+ {+ query: {+ ...router.query,+ format: link?.image?.endsWith(".png")+ ? ArchivedFormat.png+ : ArchivedFormat.jpeg,+ },},- },- undefined,- { shallow: true }- )- }- checked={- format === ArchivedFormat.png || format === ArchivedFormat.jpeg- }- >- {t("screenshot")}- </DropdownMenuCheckboxItem>- )}- {formatAvailable(link, "pdf") && (- <DropdownMenuCheckboxItem- onSelect={() =>- router.push(- {- query: {- ...router.query,- format: ArchivedFormat.pdf,+ undefined,+ { shallow: true }+ )+ }+ checked={+ format === ArchivedFormat.png ||+ format === ArchivedFormat.jpeg+ }+ >+ {t("screenshot")}+ </DropdownMenuCheckboxItem>+ )}+ {formatAvailable(link, "pdf") && (+ <DropdownMenuCheckboxItem+ onSelect={() =>+ router.push(+ {+ query: {+ ...router.query,+ format: ArchivedFormat.pdf,+ },},- },- undefined,- { shallow: true }- )- }- checked={format === ArchivedFormat.pdf}- >- {t("pdf")}- </DropdownMenuCheckboxItem>- )}- </DropdownMenuContent>- </DropdownMenu>- {/* <LinkActions- link={link}- collection={collection}- linkModal={linkModal}- setLinkModal={(e) => setLinkModal(e)}- ghost- /> */}+ undefined,+ { shallow: true }+ )+ }+ checked={format === ArchivedFormat.pdf}+ >+ {t("pdf")}+ </DropdownMenuCheckboxItem>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ <LinkActions+ link={link}+ collection={collection}+ linkModal={linkModal}+ setLinkModal={(e) => setLinkModal(e)}+ ghost+ />+ </div></div>);};diff --git a/apps/web/components/Preservation/PreservationPageContent.tsx b/apps/web/components/Preservation/PreservationPageContent.tsxindex f874d0fd..0da5d18f 100644--- a/apps/web/components/Preservation/PreservationPageContent.tsx+++ b/apps/web/components/Preservation/PreservationPageContent.tsx@@ -2,6 +2,7 @@ import React, { useEffect } from "react";import { useRouter } from "next/router";import { useGetLink, useLinks } from "@linkwarden/router/links";import { PreservationContent } from "./PreservationContent";+import PreservationNavbar from "./PreservationNavbar";export default function PreservationPageContent() {const router = useRouter();@@ -9,24 +10,21 @@ export default function PreservationPageContent() {let isPublicRoute = router.pathname.startsWith("/public") ? true : undefined;- const {- data: link,- mutateAsync: fetchLink,- error,- } = useGetLink(isPublicRoute);+ const { data: link, refetch } = useGetLink({+ id: Number(router.query.id),+ isPublicRoute,+ });useEffect(() => {- fetchLink({- id: Number(router.query.id),- });-let interval: NodeJS.Timeout | null = null;if (link &&(!link?.image || !link?.pdf || !link?.readable || !link?.monolith)) {interval = setInterval(() => {- fetchLink({ id: link.id as number });+ refetch().catch((error) => {+ console.error("Error refetching link:", error);+ });}, 5000);} else if (interval) {clearInterval(interval);@@ -38,8 +36,13 @@ export default function PreservationPageContent() {}, [links]);return (- <div className="w-screen h-screen bg-base-200">- <PreservationContent link={link} format={Number(router.query.format)} />+ <div>+ {link?.id && (+ <PreservationNavbar link={link} format={Number(router.query.format)} />+ )}+ <div className="bg-base-200 overflow-y-auto w-screen h-[calc(100vh-3rem)]">+ <PreservationContent link={link} format={Number(router.query.format)} />+ </div></div>);}diff --git a/apps/web/lib/api/controllers/links/linkId/getLinkById.ts b/apps/web/lib/api/controllers/links/linkId/getLinkById.tsindex 627e3331..1e05129a 100644--- a/apps/web/lib/api/controllers/links/linkId/getLinkById.ts+++ b/apps/web/lib/api/controllers/links/linkId/getLinkById.ts@@ -30,15 +30,18 @@ export default async function getLinkById(userId: number, linkId: number) {include: {tags: true,collection: true,- pinnedBy: isCollectionOwner- ? {- where: { id: userId },- select: { id: true },- }- : undefined,+ pinnedBy: {+ where: { id: userId },+ select: { id: true },+ },},});+ // strip out the other users from pinnedBy+ if (link?.pinnedBy && link.pinnedBy.length > 0) {+ link.pinnedBy = link.pinnedBy.filter((p) => p.id === userId);+ }+return { response: link, status: 200 };}}diff --git a/apps/web/pages/links/[id].tsx b/apps/web/pages/links/[id].tsxindex ce6cc98b..c5ecd6cf 100644--- a/apps/web/pages/links/[id].tsx+++ b/apps/web/pages/links/[id].tsx@@ -1,7 +1,6 @@import LinkDetails from "@/components/LinkDetails";import { useGetLink } from "@linkwarden/router/links";import { useRouter } from "next/router";-import { useEffect } from "react";import getServerSideProps from "@/lib/client/getServerSideProps";const Index = () => {@@ -10,17 +9,16 @@ const Index = () => {let isPublicRoute = router.pathname.startsWith("/public") ? true : undefined;- const getLink = useGetLink(isPublicRoute);-- useEffect(() => {- getLink.mutate({ id: Number(id) });- }, []);+ const { data } = useGetLink({+ id: Number(id) as number,+ isPublicRoute,+ });return (<div className="flex h-screen">- {getLink.data ? (+ {data?.id ? (<LinkDetails- activeLink={getLink.data}+ activeLink={data}className="sm:max-w-xl sm:m-auto sm:p-5 w-full"standalone/>diff --git a/apps/web/pages/public/links/[id].tsx b/apps/web/pages/public/links/[id].tsxindex ce6cc98b..c5ecd6cf 100644--- a/apps/web/pages/public/links/[id].tsx+++ b/apps/web/pages/public/links/[id].tsx@@ -1,7 +1,6 @@import LinkDetails from "@/components/LinkDetails";import { useGetLink } from "@linkwarden/router/links";import { useRouter } from "next/router";-import { useEffect } from "react";import getServerSideProps from "@/lib/client/getServerSideProps";const Index = () => {@@ -10,17 +9,16 @@ const Index = () => {let isPublicRoute = router.pathname.startsWith("/public") ? true : undefined;- const getLink = useGetLink(isPublicRoute);-- useEffect(() => {- getLink.mutate({ id: Number(id) });- }, []);+ const { data } = useGetLink({+ id: Number(id) as number,+ isPublicRoute,+ });return (<div className="flex h-screen">- {getLink.data ? (+ {data?.id ? (<LinkDetails- activeLink={getLink.data}+ activeLink={data}className="sm:max-w-xl sm:m-auto sm:p-5 w-full"standalone/>diff --git a/packages/router/links.tsx b/packages/router/links.tsxindex ab343b67..7a96725d 100644--- a/packages/router/links.tsx+++ b/packages/router/links.tsx@@ -2,6 +2,7 @@ import {useInfiniteQuery,useQueryClient,useMutation,+ useQuery,} from "@tanstack/react-query";import { useMemo } from "react";import {@@ -11,7 +12,10 @@ import {MobileAuth,} from "@linkwarden/types";import { useSession } from "next-auth/react";-import { LinkArchiveActionSchemaType, PostLinkSchemaType } from "@linkwarden/lib/schemaValidation";+import {+ LinkArchiveActionSchemaType,+ PostLinkSchemaType,+} from "@linkwarden/lib/schemaValidation";import getFormatFromContentType from "@linkwarden/lib/getFormatFromContentType";import getLinkTypeFromFormat from "@linkwarden/lib/getLinkTypeFromFormat";@@ -64,10 +68,10 @@ const useFetchLinks = (params: string, auth?: MobileAuth) => {url,auth?.session? {- headers: {- Authorization: `Bearer ${auth.session}`,- },- }+ headers: {+ Authorization: `Bearer ${auth.session}`,+ },+ }: undefined);const data = await response.json();@@ -179,6 +183,7 @@ const useUpdateLink = () => {},onSuccess: (data) => {queryClient.invalidateQueries({ queryKey: ["links"] });+ queryClient.invalidateQueries({ queryKey: ["link", data.id] });queryClient.invalidateQueries({ queryKey: ["dashboardData"] });queryClient.invalidateQueries({ queryKey: ["collections"] });queryClient.invalidateQueries({ queryKey: ["tags"] });@@ -230,86 +235,86 @@ const useDeleteLink = () => {});};-const useGetLink = (isPublicRoute?: boolean, auth?: MobileAuth) => {- const queryClient = useQueryClient();-- return useMutation({- mutationFn: async ({ id }: { id: number }) => {- const path =- (auth?.instance ? auth?.instance : "") +- (isPublicRoute ? `/api/v1/public/links/${id}` : `/api/v1/links/${id}`);-- const response = await fetch(- path,- auth?.session- ? {- headers: {- Authorization: `Bearer ${auth?.session}`,- },- }- : undefined- );- const data = await response.json();-- if (!response.ok) throw new Error(data.response);+type UseGetLinkParams = {+ id: number;+ isPublicRoute?: boolean;+ auth?: MobileAuth;+};- return data.response;- },- onSuccess: (data: LinkIncludingShortenedCollectionAndTags) => {- queryClient.setQueryData(["dashboardData"], (oldData: any) => {- if (!oldData?.links) return undefined;- return {- ...oldData,- links: oldData.links.map((e: any) => (e.id === data.id ? data : e)),- };- });+const useGetLink = ({ id, isPublicRoute = false, auth }: UseGetLinkParams) => {+ const queryClient = useQueryClient();- queryClient.setQueriesData({ queryKey: ["links"] }, (oldData: any) => {- if (!oldData) return undefined;+ return useQuery(+ // unique key for this link+ {+ queryKey: ["link", id, isPublicRoute],+ placeholderData: {} as LinkIncludingShortenedCollectionAndTags,+ enabled: id != null,+ queryFn: async () => {+ const base = auth?.instance ?? "";+ const route = isPublicRoute+ ? `/api/v1/public/links/${id}`+ : `/api/v1/links/${id}`;+ const url = `${base}${route}`;++ const res = await fetch(+ url,+ auth?.session+ ? {+ headers: { Authorization: `Bearer ${auth.session}` },+ }+ : undefined+ );+ const payload = await res.json();+ if (!res.ok) {+ throw new Error(payload.response ?? "Failed to fetch link");+ }- const newPages = oldData.pages?.map((page: any) => {- if (!page?.links) {- return page;- }+ const data =+ payload.response as LinkIncludingShortenedCollectionAndTags;+ // update dashboardData.links+ queryClient.setQueryData(["dashboardData"], (old: any) => {+ if (!old?.links) return old;return {- ...page,- links: page.links.map((item: any) =>- item.id === data.id ? data : item- ),+ ...old,+ links: old.links.map((l: any) => (l.id === data.id ? data : l)),};});- return {- ...oldData,- pages: newPages,- };- });+ // update paginated "links"+ queryClient.setQueriesData({ queryKey: ["links"] }, (old: any) => {+ if (!old?.pages) return old;+ return {+ ...old,+ pages: old.pages.map((page: any) => ({+ ...page,+ links: page.links.map((l: any) => (l.id === data.id ? data : l)),+ })),+ };+ });- queryClient.setQueriesData(- { queryKey: ["publicLinks"] },- (oldData: any) => {- if (!oldData) return undefined;- const newPages = oldData.pages?.map((page: any) => {- if (!page?.links) {- return page;- }+ // update paginated "publicLinks"+ queryClient.setQueriesData(+ { queryKey: ["publicLinks"] },+ (old: any) => {+ if (!old?.pages) return old;return {- ...page,- links: page.links.map((item: any) =>- item.id === data.id ? data : item- ),+ ...old,+ pages: old.pages.map((page: any) => ({+ ...page,+ links: page.links.map((l: any) =>+ l.id === data.id ? data : l+ ),+ })),};- });+ }+ );- return {- ...oldData,- pages: newPages,- };- }- );- },- });+ return data;+ },+ }+ );};const useBulkDeleteLinks = () => {@@ -446,8 +451,8 @@ const useUpdateFile = () => {const res = await fetch(`/api/v1/archives/${linkId}?format=` +- format +- (isPreview ? "&preview=true" : ""),+ format ++ (isPreview ? "&preview=true" : ""),{body: formBody,method: "POST",