diff --git a/src/contexts/HomeContext.tsx b/src/contexts/HomeContext.tsx index 8fcc750..f7b3f12 100644 --- a/src/contexts/HomeContext.tsx +++ b/src/contexts/HomeContext.tsx @@ -64,6 +64,7 @@ type HomeContextStore = { loadFutureContent: () => void, doSidebarSearch: (query: string) => void, updateSidebarQuery: (selection: SelectionOption) => void, + getFirstPage: () => void, } } @@ -387,6 +388,14 @@ export const HomeProvider = (props: { children: ContextChildren }) => { } }; + const getFirstPage = () => { + const feed = store.selectedFeed; + if (!feed?.hex) return; + + clearNotes(); + fetchNotes(feed.hex , `${APP_ID}`, 0, feed.includeReplies); + }; + const updatePage = (content: NostrEventContent, scope?: 'future') => { if (content.kind === Kind.Metadata) { const user = content as NostrUserContent; @@ -698,6 +707,7 @@ export const HomeProvider = (props: { children: ContextChildren }) => { loadFutureContent, doSidebarSearch, updateSidebarQuery, + getFirstPage, }, }); diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index a9dc52d..27e9085 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -111,7 +111,7 @@ const Home: Component = () => { const loadNewContent = () => { if (newNotesCount() > 100 || app?.appState === 'waking') { - location.reload(); + context?.actions.getFirstPage(); return; }