mirror of
https://github.com/PrimalHQ/primal-web-app.git
synced 2024-10-01 17:31:13 +00:00
When 100+ future notes are available do not reload
This commit is contained in:
parent
f07932707d
commit
e287eac150
@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -111,7 +111,7 @@ const Home: Component = () => {
|
||||
|
||||
const loadNewContent = () => {
|
||||
if (newNotesCount() > 100 || app?.appState === 'waking') {
|
||||
location.reload();
|
||||
context?.actions.getFirstPage();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user