@@ -32,16 +32,17 @@ export interface Props {
3232 characterId ?: number
3333 ListHeaderComponent ?: React . ReactNode
3434 visibility ?: PageVisibilityEnum
35+ updateFeedAfterPost ?: boolean
3536}
3637
3738export const useFeedList = < T extends { } > ( props : Props & T ) => {
38- const { ListHeaderComponent, visibility, handle, type, searchKeyword, contentContainerStyle = { } , tags = [ ] , topic, daysInterval = 7 , onScroll, characterId, ...restProps } = props ;
39+ const { ListHeaderComponent, updateFeedAfterPost = false , visibility, handle, type, searchKeyword, contentContainerStyle = { } , tags = [ ] , topic, daysInterval = 7 , onScroll, characterId, ...restProps } = props ;
3940 const { width } = useWindowDimensions ( ) ;
4041 const { feedList, feed } = useFeedData ( props ) ;
4142 const [ isRefetching , setIsRefetching ] = useState < boolean > ( false ) ;
4243 const listRef = useRef < MasonryFlashListRef < ExpandedNote > > ( null ) ;
4344 const { isDarkMode } = useThemeStore ( ) ;
44- const { isProcessing } = usePostIndicatorStore ( ) ;
45+ const { subscribe } = usePostIndicatorStore ( ) ;
4546 const i18nC = useTranslation ( "common" ) ;
4647
4748 useEffect ( ( ) => {
@@ -75,10 +76,20 @@ export const useFeedList = <T extends {}>(props: Props & T) => {
7576 } , [ feed . refetch , isRefetching ] ) ;
7677
7778 useEffect ( ( ) => {
78- if ( ! isProcessing ) {
79- onRefetch ( ) ;
79+ if ( ! updateFeedAfterPost ) {
80+ return ;
8081 }
81- } , [ isProcessing ] ) ;
82+
83+ const unsubscribe = subscribe ( ( isProcessing ) => {
84+ if ( ! isProcessing ) {
85+ onRefetch ( ) ;
86+ }
87+ } ) ;
88+
89+ return ( ) => {
90+ unsubscribe ( ) ;
91+ } ;
92+ } , [ subscribe , updateFeedAfterPost ] ) ;
8293
8394 return useMemo < MasonryFlashListProps < any > > ( ( ) => ( {
8495 data : feedList ,
0 commit comments