Notifications: skip resolve during boot (#330)
## Issue - Large resolve count (albeit batched) on bootup. ## Changes - Skip the call on bootup. The same call will happen when you click the notification bell, so it's not too late to resolve at that time. - Added `true` to `doResolveUris` to return cached results, otherwise it will keep resolving the same channels every time we enter Notifications Page.
This commit is contained in:
parent
6a33ed337b
commit
328b60d021
2 changed files with 26 additions and 22 deletions
|
@ -545,7 +545,7 @@ export function doSignIn() {
|
|||
|
||||
dispatch(doGetAndPopulatePreferences());
|
||||
dispatch(doNotificationSocketConnect(true));
|
||||
dispatch(doNotificationList());
|
||||
dispatch(doNotificationList(null, false));
|
||||
dispatch(doCheckPendingClaims());
|
||||
dispatch(doBalanceSubscribe());
|
||||
dispatch(doFetchChannelListMine());
|
||||
|
|
|
@ -45,7 +45,7 @@ export function doDismissError() {
|
|||
};
|
||||
}
|
||||
|
||||
export function doNotificationList(types?: Array<string>) {
|
||||
export function doNotificationList(types?: Array<string>, resolve: boolean = true) {
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const notificationTypes = selectNotificationCategories(state);
|
||||
|
@ -72,6 +72,8 @@ export function doNotificationList(types?: Array<string>) {
|
|||
|
||||
return Lbryio.call('notification', 'list', params).then((response) => {
|
||||
const notifications = response || [];
|
||||
|
||||
if (resolve) {
|
||||
const channelsToResolve = notifications
|
||||
.filter((notification: WebNotification) => {
|
||||
if (
|
||||
|
@ -92,7 +94,9 @@ export function doNotificationList(types?: Array<string>) {
|
|||
}
|
||||
});
|
||||
|
||||
dispatch(doResolveUris(channelsToResolve));
|
||||
dispatch(doResolveUris(channelsToResolve, true));
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.NOTIFICATION_LIST_COMPLETED,
|
||||
data: {
|
||||
|
|
Loading…
Reference in a new issue