refactor: optimize note interaction data processing
This commit is contained in:
parent
2d2153448d
commit
18ce08ce07
13 changed files with 289 additions and 293 deletions
9
src/hooks/useNoteStatsById.tsx
Normal file
9
src/hooks/useNoteStatsById.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import noteStats from '@/services/note-stats.service'
|
||||
import { useSyncExternalStore } from 'react'
|
||||
|
||||
export function useNoteStatsById(noteId: string) {
|
||||
return useSyncExternalStore(
|
||||
(cb) => noteStats.subscribeNoteStats(noteId, cb),
|
||||
() => noteStats.getNoteStats(noteId)
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue