Skip to content

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

refactor links page

Kha Nguyen20fde711d1e3
diff --git a/apps/web/pages/links/index.tsx b/apps/web/pages/links/index.tsx
index b9c6f1a8..19a5d098 100644
--- a/apps/web/pages/links/index.tsx
+++ b/apps/web/pages/links/index.tsx
@@ -100,31 +100,28 @@ export default function Index() {
return;
}
- // Handle moving the link to a different collection
- if (activeLink.collection.id !== collectionId) {
- const updatedLink: LinkIncludingShortenedCollectionAndTags = {
- ...activeLink,
- collection: {
- id: collectionId,
- name: collectionName,
- ownerId,
- },
- };
-
- const load = toast.loading(t("updating"));
- await updateLink.mutateAsync(updatedLink, {
- onSettled: (_, error) => {
- toast.dismiss(load);
- if (error) {
- // If there's an error, invalidate queries to restore the original state
- queryClient.invalidateQueries({ queryKey: ["dashboardData"] });
- toast.error(error.message);
- } else {
- toast.success(t("updated"));
- }
- },
- });
- }
+ const updatedLink: LinkIncludingShortenedCollectionAndTags = {
+ ...activeLink,
+ collection: {
+ id: collectionId,
+ name: collectionName,
+ ownerId,
+ },
+ };
+
+ const load = toast.loading(t("updating"));
+ await updateLink.mutateAsync(updatedLink, {
+ onSettled: (_, error) => {
+ toast.dismiss(load);
+ if (error) {
+ // If there's an error, invalidate queries to restore the original state
+ queryClient.invalidateQueries({ queryKey: ["dashboardData"] });
+ toast.error(error.message);
+ } else {
+ toast.success(t("updated"));
+ }
+ },
+ });
};
return (