diff --git a/apps/renderer/src/modules/entry-column/hooks/useEntriesByView.ts b/apps/renderer/src/modules/entry-column/hooks/useEntriesByView.ts index 51b7633b2..f00c1be05 100644 --- a/apps/renderer/src/modules/entry-column/hooks/useEntriesByView.ts +++ b/apps/renderer/src/modules/entry-column/hooks/useEntriesByView.ts @@ -129,12 +129,8 @@ export const useEntriesByView = ({ onReset }: { onReset?: () => void }) => { const sortEntries = useMemo( () => - isCollection - ? sortEntriesIdByStarAt(entryIds) - : listId - ? sortEntriesIdByEntryInsertedAt(entryIds) - : sortEntriesIdByEntryPublishedAt(entryIds), - [entryIds, isCollection, listId], + isCollection ? sortEntriesIdByStarAt(entryIds) : sortEntriesIdByEntryPublishedAt(entryIds), + [entryIds, isCollection], ) const groupByDate = useGeneralSettingKey("groupByDate") @@ -204,17 +200,6 @@ function sortEntriesIdByStarAt(entries: string[]) { }) } -function sortEntriesIdByEntryInsertedAt(entries: string[]) { - const entriesId2Map = entryActions.getFlattenMapEntries() - return entries - .slice() - .sort( - (a, b) => - entriesId2Map[b]?.entries.insertedAt.localeCompare(entriesId2Map[a]?.entries.insertedAt!) || - 0, - ) -} - const useFetchEntryContentByStream = (remoteEntryIds?: string[]) => { const { mutate: updateEntryContent } = useMutation({ mutationKey: ["stream-entry-content", remoteEntryIds], diff --git a/apps/renderer/src/queries/entries.ts b/apps/renderer/src/queries/entries.ts index a42f845f1..8c0a3be2c 100644 --- a/apps/renderer/src/queries/entries.ts +++ b/apps/renderer/src/queries/entries.ts @@ -142,10 +142,7 @@ export const useEntries = ({ return useAuthInfiniteQuery(entries.entries({ feedId, inboxId, listId, view, read }), { enabled: feedId !== undefined || inboxId !== undefined || listId !== undefined, - getNextPageParam: (lastPage) => - listId - ? lastPage.data?.at(-1)?.entries.insertedAt - : lastPage.data?.at(-1)?.entries.publishedAt, + getNextPageParam: (lastPage) => lastPage.data?.at(-1)?.entries.publishedAt, initialPageParam: undefined, refetchOnWindowFocus: false, refetchOnReconnect: false, diff --git a/apps/renderer/src/store/subscription/hooks.ts b/apps/renderer/src/store/subscription/hooks.ts index 32a3bd963..9ae21bd46 100644 --- a/apps/renderer/src/store/subscription/hooks.ts +++ b/apps/renderer/src/store/subscription/hooks.ts @@ -58,7 +58,7 @@ export const useCategoriesByView = (view: FeedViewType) => (state) => new Set( subscriptionByViewSelector(view)(state) - .map((subscription) => subscription!.category) + .map((subscription) => subscription?.category) .filter((category) => category !== null && category !== undefined) .filter(Boolean), ), diff --git a/packages/shared/src/hono.ts b/packages/shared/src/hono.ts index 9dfdb0c09..133c277c8 100644 --- a/packages/shared/src/hono.ts +++ b/packages/shared/src/hono.ts @@ -2984,164 +2984,6 @@ declare const subscriptionsRelations: drizzle_orm.Relations<"subscriptions", { rsshubUsage: drizzle_orm.One<"rsshub_usage", true>; }>; -declare const timeline: drizzle_orm_pg_core.PgTableWithColumns<{ - name: "timeline"; - schema: undefined; - columns: { - userId: drizzle_orm_pg_core.PgColumn<{ - name: "user_id"; - tableName: "timeline"; - dataType: "string"; - columnType: "PgText"; - data: string; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: [string, ...string[]]; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - feedId: drizzle_orm_pg_core.PgColumn<{ - name: "feedId"; - tableName: "timeline"; - dataType: "string"; - columnType: "PgText"; - data: string; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: [string, ...string[]]; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - entryId: drizzle_orm_pg_core.PgColumn<{ - name: "entry_id"; - tableName: "timeline"; - dataType: "string"; - columnType: "PgText"; - data: string; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: [string, ...string[]]; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - publishedAt: drizzle_orm_pg_core.PgColumn<{ - name: "published_at"; - tableName: "timeline"; - dataType: "date"; - columnType: "PgTimestamp"; - data: Date; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: undefined; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - insertedAt: drizzle_orm_pg_core.PgColumn<{ - name: "inserted_at"; - tableName: "timeline"; - dataType: "date"; - columnType: "PgTimestamp"; - data: Date; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: undefined; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - view: drizzle_orm_pg_core.PgColumn<{ - name: "view"; - tableName: "timeline"; - dataType: "number"; - columnType: "PgSmallInt"; - data: number; - driverParam: string | number; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: undefined; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - read: drizzle_orm_pg_core.PgColumn<{ - name: "read"; - tableName: "timeline"; - 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"; -}>; -declare const timelineOpenAPISchema: zod.ZodObject<{ - userId: zod.ZodString; - feedId: zod.ZodString; - entryId: zod.ZodString; - publishedAt: zod.ZodString; - insertedAt: zod.ZodString; - view: zod.ZodNumber; - read: zod.ZodNullable; -}, zod.UnknownKeysParam, zod.ZodTypeAny, { - userId: string; - view: number; - feedId: string; - insertedAt: string; - publishedAt: string; - entryId: string; - read: boolean | null; -}, { - userId: string; - view: number; - feedId: string; - insertedAt: string; - publishedAt: string; - entryId: string; - read: boolean | null; -}>; -declare const timelineRelations: drizzle_orm.Relations<"timeline", { - entries: drizzle_orm.One<"entries", true>; - feeds: drizzle_orm.One<"feeds", true>; - collections: drizzle_orm.One<"collections", true>; - subscriptions: drizzle_orm.One<"subscriptions", true>; -}>; - declare const inboxesEntries: drizzle_orm_pg_core.PgTableWithColumns<{ name: "inboxes_entries"; schema: undefined; @@ -4561,6 +4403,7 @@ declare const listsRelations: drizzle_orm.Relations<"lists", { owner: drizzle_orm.One<"user", true>; listsSubscriptions: drizzle_orm.Many<"lists_subscriptions">; }>; +type ListModel = InferInsertModel; declare const listsSubscriptions: drizzle_orm_pg_core.PgTableWithColumns<{ name: "lists_subscriptions"; @@ -4634,23 +4477,6 @@ declare const listsSubscriptions: drizzle_orm_pg_core.PgTableWithColumns<{ identity: undefined; generated: undefined; }, {}, {}>; - lastViewedAt: drizzle_orm_pg_core.PgColumn<{ - name: "last_viewed_at"; - tableName: "lists_subscriptions"; - dataType: "date"; - columnType: "PgTimestamp"; - data: Date; - driverParam: string; - notNull: false; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: undefined; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; createdAt: drizzle_orm_pg_core.PgColumn<{ name: "created_at"; tableName: "lists_subscriptions"; @@ -4693,7 +4519,6 @@ declare const listsSubscriptionsOpenAPISchema: zod.ZodObject<{ listId: zod.ZodString; view: zod.ZodNumber; title: zod.ZodNullable; - lastViewedAt: zod.ZodNullable; createdAt: zod.ZodString; isPrivate: zod.ZodBoolean; }, zod.UnknownKeysParam, zod.ZodTypeAny, { @@ -4703,7 +4528,6 @@ declare const listsSubscriptionsOpenAPISchema: zod.ZodObject<{ view: number; isPrivate: boolean; listId: string; - lastViewedAt: string | null; }, { createdAt: string; userId: string; @@ -4711,109 +4535,12 @@ declare const listsSubscriptionsOpenAPISchema: zod.ZodObject<{ view: number; isPrivate: boolean; listId: string; - lastViewedAt: string | null; }>; declare const listsSubscriptionsRelations: drizzle_orm.Relations<"lists_subscriptions", { users: drizzle_orm.One<"user", true>; lists: drizzle_orm.One<"lists", true>; }>; -declare const listsTimeline: drizzle_orm_pg_core.PgTableWithColumns<{ - name: "lists_timeline"; - schema: undefined; - columns: { - listId: drizzle_orm_pg_core.PgColumn<{ - name: "list_id"; - tableName: "lists_timeline"; - dataType: "string"; - columnType: "PgText"; - data: string; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: [string, ...string[]]; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - feedId: drizzle_orm_pg_core.PgColumn<{ - name: "feedId"; - tableName: "lists_timeline"; - dataType: "string"; - columnType: "PgText"; - data: string; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: [string, ...string[]]; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - entryId: drizzle_orm_pg_core.PgColumn<{ - name: "entry_id"; - tableName: "lists_timeline"; - dataType: "string"; - columnType: "PgText"; - data: string; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: [string, ...string[]]; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - insertedAt: drizzle_orm_pg_core.PgColumn<{ - name: "inserted_at"; - tableName: "lists_timeline"; - dataType: "date"; - columnType: "PgTimestamp"; - data: Date; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: undefined; - baseColumn: never; - identity: undefined; - generated: undefined; - }, {}, {}>; - }; - dialect: "pg"; -}>; -declare const listsTimelineOpenAPISchema: zod.ZodObject<{ - listId: zod.ZodString; - feedId: zod.ZodString; - entryId: zod.ZodString; - insertedAt: zod.ZodString; -}, zod.UnknownKeysParam, zod.ZodTypeAny, { - feedId: string; - insertedAt: string; - entryId: string; - listId: string; -}, { - feedId: string; - insertedAt: string; - entryId: string; - listId: string; -}>; -declare const listsTimelineRelations: drizzle_orm.Relations<"lists_timeline", { - entries: drizzle_orm.One<"entries", true>; - feeds: drizzle_orm.One<"feeds", true>; -}>; - declare const messaging: drizzle_orm_pg_core.PgTableWithColumns<{ name: "messaging"; schema: undefined; @@ -5240,6 +4967,210 @@ declare const settings: drizzle_orm_pg_core.PgTableWithColumns<{ dialect: "pg"; }>; +declare const timeline: drizzle_orm_pg_core.PgTableWithColumns<{ + name: "timeline"; + schema: undefined; + columns: { + userId: drizzle_orm_pg_core.PgColumn<{ + name: "user_id"; + tableName: "timeline"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + feedId: drizzle_orm_pg_core.PgColumn<{ + name: "feedId"; + tableName: "timeline"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + entryId: drizzle_orm_pg_core.PgColumn<{ + name: "entry_id"; + tableName: "timeline"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + publishedAt: drizzle_orm_pg_core.PgColumn<{ + name: "published_at"; + tableName: "timeline"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + insertedAt: drizzle_orm_pg_core.PgColumn<{ + name: "inserted_at"; + tableName: "timeline"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + view: drizzle_orm_pg_core.PgColumn<{ + name: "view"; + tableName: "timeline"; + dataType: "number"; + columnType: "PgSmallInt"; + data: number; + driverParam: string | number; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + read: drizzle_orm_pg_core.PgColumn<{ + name: "read"; + tableName: "timeline"; + 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; + }, {}, {}>; + from: drizzle_orm_pg_core.PgColumn<{ + name: "from"; + tableName: "timeline"; + dataType: "array"; + columnType: "PgArray"; + data: string[]; + driverParam: string | string[]; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: drizzle_orm.Column<{ + name: "from"; + tableName: "timeline"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + identity: undefined; + generated: undefined; + }, {}, { + baseBuilder: drizzle_orm_pg_core.PgColumnBuilder<{ + name: "from"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + }, {}, {}, drizzle_orm.ColumnBuilderExtraConfig>; + size: undefined; + }>; + }; + dialect: "pg"; +}>; +declare const timelineOpenAPISchema: zod.ZodObject<{ + userId: zod.ZodString; + feedId: zod.ZodString; + entryId: zod.ZodString; + publishedAt: zod.ZodString; + insertedAt: zod.ZodString; + view: zod.ZodNumber; + read: zod.ZodNullable; + from: zod.ZodNullable>; +}, zod.UnknownKeysParam, zod.ZodTypeAny, { + userId: string; + view: number; + from: string[] | null; + feedId: string; + insertedAt: string; + publishedAt: string; + entryId: string; + read: boolean | null; +}, { + userId: string; + view: number; + from: string[] | null; + feedId: string; + insertedAt: string; + publishedAt: string; + entryId: string; + read: boolean | null; +}>; +declare const timelineRelations: drizzle_orm.Relations<"timeline", { + entries: drizzle_orm.One<"entries", true>; + feeds: drizzle_orm.One<"feeds", true>; + collections: drizzle_orm.One<"collections", true>; + subscriptions: drizzle_orm.One<"subscriptions", true>; +}>; + declare const user: drizzle_orm_pg_core.PgTableWithColumns<{ name: "user"; schema: undefined; @@ -14313,7 +14244,6 @@ declare const _routes: hono_hono_base.HonoBase, "/">; type AppType = typeof _routes; -export { type ActionsModel, type AirdropActivity, type AppType, type AttachmentsModel, type AuthSession, type AuthUser, CommonEntryFields, type ConditionItem, type DetailModel, type EntriesModel, type EntryReadHistoriesModel, type ExtraModel, type FeedModel, type MediaModel, type MessagingData, MessagingType, type SettingsModel, type UrlReadsModel, account, achievements, achievementsOpenAPISchema, actions, actionsItemOpenAPISchema, actionsOpenAPISchema, actionsRelations, activityEnum, airdrops, airdropsOpenAPISchema, attachmentsZodSchema, authPlugins, boosts, collections, collectionsOpenAPISchema, collectionsRelations, detailModelSchema, entries, entriesOpenAPISchema, entriesRelations, entryReadHistories, entryReadHistoriesOpenAPISchema, entryReadHistoriesRelations, extraZodSchema, feedPowerTokens, feedPowerTokensOpenAPISchema, feedPowerTokensRelations, feeds, feedsOpenAPISchema, feedsRelations, inboxHandleSchema, inboxes, inboxesEntries, inboxesEntriesInsertOpenAPISchema, type inboxesEntriesModel, inboxesEntriesOpenAPISchema, inboxesEntriesRelations, inboxesOpenAPISchema, inboxesRelations, invitations, invitationsOpenAPISchema, invitationsRelations, languageSchema, levels, levelsOpenAPISchema, levelsRelations, lists, listsOpenAPISchema, listsRelations, listsSubscriptions, listsSubscriptionsOpenAPISchema, listsSubscriptionsRelations, listsTimeline, listsTimelineOpenAPISchema, listsTimelineRelations, lower, mediaZodSchema, messaging, messagingOpenAPISchema, messagingRelations, rsshub, rsshubOpenAPISchema, rsshubPurchase, rsshubUsage, rsshubUsageOpenAPISchema, rsshubUsageRelations, session, settings, subscriptions, subscriptionsOpenAPISchema, subscriptionsRelations, timeline, timelineOpenAPISchema, timelineRelations, transactionType, transactions, transactionsOpenAPISchema, transactionsRelations, twoFactor, urlReads, urlReadsOpenAPISchema, user, users, usersOpenApiSchema, usersRelations, verification, wallets, walletsOpenAPISchema, walletsRelations }; +export { type ActionsModel, type AirdropActivity, type AppType, type AttachmentsModel, type AuthSession, type AuthUser, CommonEntryFields, type ConditionItem, type DetailModel, type EntriesModel, type EntryReadHistoriesModel, type ExtraModel, type FeedModel, type ListModel, type MediaModel, type MessagingData, MessagingType, type SettingsModel, type UrlReadsModel, account, achievements, achievementsOpenAPISchema, actions, actionsItemOpenAPISchema, actionsOpenAPISchema, actionsRelations, activityEnum, airdrops, airdropsOpenAPISchema, attachmentsZodSchema, authPlugins, boosts, collections, collectionsOpenAPISchema, collectionsRelations, detailModelSchema, entries, entriesOpenAPISchema, entriesRelations, entryReadHistories, entryReadHistoriesOpenAPISchema, entryReadHistoriesRelations, extraZodSchema, feedPowerTokens, feedPowerTokensOpenAPISchema, feedPowerTokensRelations, feeds, feedsOpenAPISchema, feedsRelations, inboxHandleSchema, inboxes, inboxesEntries, inboxesEntriesInsertOpenAPISchema, type inboxesEntriesModel, inboxesEntriesOpenAPISchema, inboxesEntriesRelations, inboxesOpenAPISchema, inboxesRelations, invitations, invitationsOpenAPISchema, invitationsRelations, languageSchema, levels, levelsOpenAPISchema, levelsRelations, lists, listsOpenAPISchema, listsRelations, listsSubscriptions, listsSubscriptionsOpenAPISchema, listsSubscriptionsRelations, lower, mediaZodSchema, messaging, messagingOpenAPISchema, messagingRelations, rsshub, rsshubOpenAPISchema, rsshubPurchase, rsshubUsage, rsshubUsageOpenAPISchema, rsshubUsageRelations, session, settings, subscriptions, subscriptionsOpenAPISchema, subscriptionsRelations, timeline, timelineOpenAPISchema, timelineRelations, transactionType, transactions, transactionsOpenAPISchema, transactionsRelations, twoFactor, urlReads, urlReadsOpenAPISchema, user, users, usersOpenApiSchema, usersRelations, verification, wallets, walletsOpenAPISchema, walletsRelations };