feat(ssr): fetch more entries by feed api

This commit is contained in:
DIYgod 2025-06-02 10:17:38 +08:00
parent 234cb74281
commit bb029e7144
No known key found for this signature in database
3 changed files with 51 additions and 9 deletions

View File

@ -3,7 +3,6 @@ import { MainContainer } from "@client/components/layout/main"
import { FeedCertification } from "@client/components/ui/feed-certification"
import { FeedIcon } from "@client/components/ui/feed-icon"
import { openInFollowApp } from "@client/lib/helper"
import { useEntriesPreview } from "@client/query/entries"
import { useFeed } from "@client/query/feed"
import { FollowIcon } from "@follow/components/icons/follow.jsx"
import { Button } from "@follow/components/ui/button/index.jsx"
@ -29,9 +28,13 @@ export function Component() {
const feedData = feed.data?.feed
const analytics = feed.data?.analytics
const isSubscribed = !!feed.data?.subscription
const entries = useEntriesPreview({
id,
})
const entries = feed.data?.entries.map((entry) => ({
...entry,
id: entry.guid,
content: entry.description,
feedId: feed.data?.feed.id,
insertedAt: entry.publishedAt,
}))
useTitle(feed.data?.feed.title)
@ -109,11 +112,7 @@ export function Component() {
</div>
</div>
<div className={cn("w-full pb-12 pt-8", "flex flex-col gap-2")}>
{entries.isLoading && !entries.data ? (
<LoadingCircle size="large" className="center mt-12" />
) : (
<Item entries={entries.data} feed={feed.data} view={view} />
)}
<Item entries={entries} feed={feed.data} view={view} />
</div>
</div>
</MainContainer>

View File

@ -7,6 +7,7 @@ async function fetchFeedById(id: string) {
const res = await apiClient.feeds.$get({
query: {
id,
entriesLimit: 8,
},
})
return res.data

View File

@ -3068,6 +3068,23 @@ declare const feeds: drizzle_orm_pg_core.PgTableWithColumns<{
identity: undefined;
generated: undefined;
}, {}, {}>;
nsfw: drizzle_orm_pg_core.PgColumn<{
name: "nsfw";
tableName: "feeds";
dataType: "boolean";
columnType: "PgBoolean";
data: boolean;
driverParam: boolean;
notNull: false;
hasDefault: false;
isPrimaryKey: false;
isAutoincrement: false;
hasRuntimeDefault: false;
enumValues: undefined;
baseColumn: never;
identity: undefined;
generated: undefined;
}, {}, {}>;
};
dialect: "pg";
}>;
@ -3089,6 +3106,7 @@ declare const feedsOpenAPISchema: zod.ZodObject<{
migrateTo: zod.ZodNullable<zod.ZodString>;
rsshubRoute: zod.ZodNullable<zod.ZodString>;
rsshubNamespace: zod.ZodNullable<zod.ZodString>;
nsfw: zod.ZodNullable<zod.ZodBoolean>;
}, zod.UnknownKeysParam, zod.ZodTypeAny, {
id: string;
image: string | null;
@ -3107,6 +3125,7 @@ declare const feedsOpenAPISchema: zod.ZodObject<{
migrateTo: string | null;
rsshubRoute: string | null;
rsshubNamespace: string | null;
nsfw: boolean | null;
}, {
id: string;
image: string | null;
@ -3125,6 +3144,7 @@ declare const feedsOpenAPISchema: zod.ZodObject<{
migrateTo: string | null;
rsshubRoute: string | null;
rsshubNamespace: string | null;
nsfw: boolean | null;
}>;
declare const feedsRelations: drizzle_orm.Relations<"feeds", {
subscriptions: drizzle_orm.Many<"subscriptions">;
@ -5926,6 +5946,23 @@ declare const trendingFeeds: drizzle_orm_pg_core.PgTableWithColumns<{
identity: undefined;
generated: undefined;
}, {}, {}>;
nsfw: drizzle_orm_pg_core.PgColumn<{
name: "nsfw";
tableName: "trendings_feeds";
dataType: "boolean";
columnType: "PgBoolean";
data: boolean;
driverParam: boolean;
notNull: false;
hasDefault: false;
isPrimaryKey: false;
isAutoincrement: false;
hasRuntimeDefault: false;
enumValues: undefined;
baseColumn: never;
identity: undefined;
generated: undefined;
}, {}, {}>;
};
dialect: "pg";
}>;
@ -5941,9 +5978,11 @@ declare const trendingFeedsOpenAPISchema: zod.ZodObject<{
score30d: zod.ZodString;
view: zod.ZodNumber;
language: zod.ZodString;
nsfw: zod.ZodNullable<zod.ZodBoolean>;
}, zod.UnknownKeysParam, zod.ZodTypeAny, {
view: number;
language: string;
nsfw: boolean | null;
feedId: string;
rankedAt: string;
score1d: string;
@ -5953,6 +5992,7 @@ declare const trendingFeedsOpenAPISchema: zod.ZodObject<{
}, {
view: number;
language: string;
nsfw: boolean | null;
feedId: string;
rankedAt: string;
score1d: string;
@ -18542,6 +18582,7 @@ declare const _routes: hono_hono_base.HonoBase<Env, ({
query: {
id?: string | undefined;
url?: string | undefined;
entriesLimit?: number | undefined;
};
};
output: {
@ -19142,6 +19183,7 @@ declare const _routes: hono_hono_base.HonoBase<Env, ({
migrateTo: string | null;
rsshubRoute: string | null;
rsshubNamespace: string | null;
nsfw: boolean | null;
} | null;
list: {
id: string;