fix: 🐛

This commit is contained in:
codytseng 2026-01-04 23:02:20 +08:00
parent 9f6045461c
commit 36959a1052
2 changed files with 6 additions and 2 deletions

View file

@ -93,6 +93,8 @@ const NoteList = forwardRef<
const [refreshCount, setRefreshCount] = useState(0)
const supportTouch = useMemo(() => isTouchDevice(), [])
const topRef = useRef<HTMLDivElement | null>(null)
const showNewNotesDirectlyRef = useRef(showNewNotesDirectly)
showNewNotesDirectlyRef.current = showNewNotesDirectly
const shouldHideEvent = useCallback(
(evt: Event) => {
@ -331,7 +333,7 @@ const NoteList = forwardRef<
}
},
onNew: (event) => {
if (showNewNotesDirectly) {
if (showNewNotesDirectlyRef.current) {
setEvents((oldEvents) =>
oldEvents.some((e) => e.id === event.id) ? oldEvents : [event, ...oldEvents]
)