From 3dbf7c7ffaded0c276eb3b7a8f4aaf8ad50dc8a1 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 14 Jan 2025 18:12:40 +0800 Subject: [PATCH] fix: fast scroll mark read --- .../src/modules/entry-column/index.tsx | 4 + packages/shared/src/hono.ts | 122 +++++++++++++++++- 2 files changed, 125 insertions(+), 1 deletion(-) diff --git a/apps/renderer/src/modules/entry-column/index.tsx b/apps/renderer/src/modules/entry-column/index.tsx index 72ac94e57..1368fa364 100644 --- a/apps/renderer/src/modules/entry-column/index.tsx +++ b/apps/renderer/src/modules/entry-column/index.tsx @@ -130,6 +130,10 @@ function EntryColumnImpl() { const renderAsRead = useGeneralSettingKey("renderMarkUnread") const handleRangeChange = useCallback( (e: Range) => { + const [_, second] = rangeQueueRef.current + if (second?.startIndex === e.startIndex) { + return + } rangeQueueRef.current.push(e) if (rangeQueueRef.current.length > 2) { rangeQueueRef.current.shift() diff --git a/packages/shared/src/hono.ts b/packages/shared/src/hono.ts index f916b5dfd..f7a011ab5 100644 --- a/packages/shared/src/hono.ts +++ b/packages/shared/src/hono.ts @@ -2409,6 +2409,104 @@ declare const entryReadHistoriesOpenAPISchema: z.ZodObject<{ userIds: string[]; readCount: number; }>; +declare const urlReads: drizzle_orm_pg_core.PgTableWithColumns<{ + name: "urlReads"; + schema: undefined; + columns: { + url: drizzle_orm_pg_core.PgColumn<{ + name: "url"; + tableName: "urlReads"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: true; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + userIds: drizzle_orm_pg_core.PgColumn<{ + name: "user_ids"; + tableName: "urlReads"; + dataType: "array"; + columnType: "PgArray"; + data: string[]; + driverParam: string | string[]; + notNull: true; + hasDefault: true; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: drizzle_orm.Column<{ + name: "user_ids"; + tableName: "urlReads"; + 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: "user_ids"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + }, {}, {}, drizzle_orm.ColumnBuilderExtraConfig>; + size: undefined; + }>; + count: drizzle_orm_pg_core.PgColumn<{ + name: "count"; + tableName: "urlReads"; + dataType: "number"; + columnType: "PgInteger"; + data: number; + driverParam: string | number; + notNull: true; + hasDefault: true; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + }; + dialect: "pg"; +}>; +type UrlReadsModel = InferInsertModel; +declare const urlReadsOpenAPISchema: z.ZodObject<{ + url: z.ZodString; + userIds: z.ZodArray; + count: z.ZodNumber; +}, z.UnknownKeysParam, z.ZodTypeAny, { + url: string; + userIds: string[]; + count: number; +}, { + url: string; + userIds: string[]; + count: number; +}>; declare const feeds: drizzle_orm_pg_core.PgTableWithColumns<{ name: "feeds"; @@ -2652,6 +2750,23 @@ declare const feeds: drizzle_orm_pg_core.PgTableWithColumns<{ identity: undefined; generated: undefined; }, {}, {}>; + migrateTo: drizzle_orm_pg_core.PgColumn<{ + name: "migrate_to"; + tableName: "feeds"; + 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; + }, {}, {}>; }; dialect: "pg"; }>; @@ -2670,6 +2785,7 @@ declare const feedsOpenAPISchema: zod.ZodObject<{ errorAt: zod.ZodNullable; ownerUserId: zod.ZodNullable; language: zod.ZodNullable; + migrateTo: zod.ZodNullable; }, zod.UnknownKeysParam, zod.ZodTypeAny, { description: string | null; title: string | null; @@ -2685,6 +2801,7 @@ declare const feedsOpenAPISchema: zod.ZodObject<{ errorAt: string | null; ownerUserId: string | null; language: string | null; + migrateTo: string | null; }, { description: string | null; title: string | null; @@ -2700,11 +2817,13 @@ declare const feedsOpenAPISchema: zod.ZodObject<{ errorAt: string | null; ownerUserId: string | null; language: string | null; + migrateTo: string | null; }>; declare const feedsRelations: drizzle_orm.Relations<"feeds", { subscriptions: drizzle_orm.Many<"subscriptions">; entries: drizzle_orm.Many<"entries">; owner: drizzle_orm.One<"user", false>; + migrateTo: drizzle_orm.One<"feeds", false>; }>; type FeedModel = InferInsertModel; @@ -15333,6 +15452,7 @@ 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, 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, 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 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 };