fix: data flash issue

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-07-03 16:13:08 +08:00
parent 4aac58e0ab
commit 9da2365002
3 changed files with 11 additions and 8 deletions
+5 -2
View File
@@ -20,6 +20,7 @@ declare const routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
emailVerified: string | null;
image: string | null;
handle: string | null;
createdAt: string;
};
};
outputFormat: "json";
@@ -103,6 +104,7 @@ declare const routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
emailVerified: string | null;
image: string | null;
handle: string | null;
createdAt: string;
} | null;
toUser: {
name: string | null;
@@ -111,6 +113,7 @@ declare const routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
emailVerified: string | null;
image: string | null;
handle: string | null;
createdAt: string;
} | null;
toFeed: {
description: string | null;
@@ -207,8 +210,8 @@ declare const routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
output: {
code: 0;
data: {
userId: string;
createdAt: string;
userId: string;
addressIndex: number;
address: string | null;
dailyPowerToken: string;
@@ -223,8 +226,8 @@ declare const routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
output: {
code: 0;
data: {
userId: string;
createdAt: string;
userId: string;
addressIndex: number;
address: string | null;
dailyPowerToken: string;
@@ -206,7 +206,7 @@ const useEntriesByView = () => {
useEffect(() => {
prevEntries.current = []
}, [activeList.feedId])
}, [activeList.feedId, activeList.view])
const localEntries = useMemo(() => {
if (!unreadOnly) {
prevEntries.current = []
@@ -244,8 +244,6 @@ const useEntriesByView = () => {
// If remote data is not available, we use the local data, get the local data length
totalCount: query.data?.pages?.[0]?.total ?? localEntries.length,
entriesIds:
// FIXME we can't filter collections in local mode, so we need to use the remote data
// activeList.id === FEED_COLLECTION_LIST ? remoteEntryIds : nextEntries,
// NOTE: if we use the remote data, priority will be given to the remote data, local data maybe had sort issue
remoteEntryIds ?? localEntries,
}
@@ -1,5 +1,5 @@
import { getUISettings, setUISetting } from "@renderer/atoms"
import { useRouteView } from "@renderer/hooks/biz/useRouteParams"
import { useRouteParms } from "@renderer/hooks/biz/useRouteParams"
import { views } from "@renderer/lib/constants"
import { cn } from "@renderer/lib/utils"
import { EntryColumn } from "@renderer/modules/entry-column"
@@ -14,7 +14,7 @@ export function Component() {
// Memo this initial value to avoid re-render
const entryColWidth = useMemo(() => getUISettings().entryColWidth, [])
const view = useRouteView()
const { feedId, view } = useRouteParms()
const inWideMode = view ? views[view].wideMode : false
const { position, separatorProps } = useResizable({
axis: "x",
@@ -40,7 +40,9 @@ export function Component() {
width: position,
}}
>
<EntryColumn />
<EntryColumn
key={`${feedId}-${view}`}
/>
</div>
{!inWideMode && (
<div