aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/components
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-11-08 17:48:54 +0900
committernsfisis <nsfisis@gmail.com>2025-11-08 17:48:54 +0900
commit79c3528bbcd82c6eed67b17747ded31af09a4a64 (patch)
tree0b544d66cfb70cdce15b005b6dffbe4aeb218248 /frontend/src/components
parent6dbc5bbcacf99e4941ee8e1fb67bd132d0f517ed (diff)
downloadfeedaka-79c3528bbcd82c6eed67b17747ded31af09a4a64.tar.gz
feedaka-79c3528bbcd82c6eed67b17747ded31af09a4a64.tar.zst
feedaka-79c3528bbcd82c6eed67b17747ded31af09a4a64.zip
fix(frontend): Fix incorrect caching settingsv0.4.1
Diffstat (limited to 'frontend/src/components')
-rw-r--r--frontend/src/components/AddFeedForm.tsx4
-rw-r--r--frontend/src/components/ArticleItem.tsx8
-rw-r--r--frontend/src/components/FeedItem.tsx8
-rw-r--r--frontend/src/components/FeedList.tsx3
4 files changed, 16 insertions, 7 deletions
diff --git a/frontend/src/components/AddFeedForm.tsx b/frontend/src/components/AddFeedForm.tsx
index 519f9e3..6d18318 100644
--- a/frontend/src/components/AddFeedForm.tsx
+++ b/frontend/src/components/AddFeedForm.tsx
@@ -8,6 +8,8 @@ interface Props {
onFeedAdded?: () => void;
}
+const urqlContextFeed = { additionalTypenames: ["Feed"] };
+
export function AddFeedForm({ onFeedAdded }: Props) {
const [url, setUrl] = useState("");
const [error, setError] = useState<string | null>(null);
@@ -20,7 +22,7 @@ export function AddFeedForm({ onFeedAdded }: Props) {
setError(null);
try {
- const result = await addFeed({ url: url.trim() });
+ const result = await addFeed({ url: url.trim() }, urqlContextFeed);
if (result.error) {
setError(result.error.message);
} else if (result.data) {
diff --git a/frontend/src/components/ArticleItem.tsx b/frontend/src/components/ArticleItem.tsx
index 4942518..c61923a 100644
--- a/frontend/src/components/ArticleItem.tsx
+++ b/frontend/src/components/ArticleItem.tsx
@@ -20,6 +20,8 @@ interface Props {
onReadChange?: (articleId: string, isRead: boolean) => void;
}
+const urqlContextArticle = { additionalTypenames: ["Article"] };
+
export function ArticleItem({ article, onReadChange }: Props) {
const [, markArticleRead] = useMutation(MarkArticleReadDocument);
const [, markArticleUnread] = useMutation(MarkArticleUnreadDocument);
@@ -32,9 +34,9 @@ export function ArticleItem({ article, onReadChange }: Props) {
onReadChange?.(articleId, newReadState);
if (isCurrentlyRead) {
- await markArticleUnread({ id: articleId });
+ await markArticleUnread({ id: articleId }, urqlContextArticle);
} else {
- await markArticleRead({ id: articleId });
+ await markArticleRead({ id: articleId }, urqlContextArticle);
}
};
@@ -43,7 +45,7 @@ export function ArticleItem({ article, onReadChange }: Props) {
window.open(article.url, "_blank", "noreferrer");
if (!article.isRead) {
onReadChange?.(article.id, true);
- await markArticleRead({ id: article.id });
+ await markArticleRead({ id: article.id }, urqlContextArticle);
}
};
diff --git a/frontend/src/components/FeedItem.tsx b/frontend/src/components/FeedItem.tsx
index 29cd531..80c8992 100644
--- a/frontend/src/components/FeedItem.tsx
+++ b/frontend/src/components/FeedItem.tsx
@@ -15,17 +15,19 @@ interface Props {
onFeedUnsubscribed?: () => void;
}
+const urqlContextFeed = { additionalTypenames: ["Feed"] };
+
export function FeedItem({ feed, onFeedUnsubscribed }: Props) {
const [, markFeedRead] = useMutation(MarkFeedReadDocument);
const [, markFeedUnread] = useMutation(MarkFeedUnreadDocument);
const [, unsubscribeFeed] = useMutation(UnsubscribeFeedDocument);
const handleMarkAllRead = async (feedId: string) => {
- await markFeedRead({ id: feedId });
+ await markFeedRead({ id: feedId }, urqlContextFeed);
};
const handleMarkAllUnread = async (feedId: string) => {
- await markFeedUnread({ id: feedId });
+ await markFeedUnread({ id: feedId }, urqlContextFeed);
};
const handleUnsubscribeFeed = async (feedId: string) => {
@@ -33,7 +35,7 @@ export function FeedItem({ feed, onFeedUnsubscribed }: Props) {
"Are you sure you want to unsubscribe from this feed?",
);
if (confirmed) {
- await unsubscribeFeed({ id: feedId });
+ await unsubscribeFeed({ id: feedId }, urqlContextFeed);
onFeedUnsubscribed?.();
}
};
diff --git a/frontend/src/components/FeedList.tsx b/frontend/src/components/FeedList.tsx
index d1d7bf3..6081293 100644
--- a/frontend/src/components/FeedList.tsx
+++ b/frontend/src/components/FeedList.tsx
@@ -6,9 +6,12 @@ interface Props {
onFeedUnsubscribed?: () => void;
}
+const urqlContextFeed = { additionalTypenames: ["Feed"] };
+
export function FeedList({ onFeedUnsubscribed }: Props) {
const [{ data, fetching, error }] = useQuery({
query: GetFeedsDocument,
+ context: urqlContextFeed,
});
if (fetching) {