gitify-app / gitify

GitHub notifications on your menu bar. Available on macOS, Windows & Linux.

Home Page:https://www.gitify.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On first load, notification icons are missing colors

adufr opened this issue Β· comments

πŸ” Is there already an issue for your problem?

  • I have checked older issues, open and closed

πŸ“ Description

When opening the app (or reloading it by pressing Cmd/Control+R), notifications are loaded without their color.

The issue is caused by the following block:

const {
fetchNotifications,
notifications,
requestFailed,
isFetching,
markNotification,
markNotificationDone,
unsubscribeNotification,
markRepoNotifications,
} = useNotifications(settings.colors);

When first running the app, it looks like useNotifications is called with colors: false because the settings might not have already be initialized, thus the following code block is not being called, resulting in the missing colors:

const cardinalData = (
await apiRequestAuth(
notification.subject.url,
'GET',
token,
)
).data;
const state =
cardinalData.state === 'closed'
? cardinalData.state_reason ||
(cardinalData.merged && 'merged') ||
'closed'
: (cardinalData.draft && 'draft') || 'open';
return {
...notification,
subject: {
...notification.subject,
state,
},
};

πŸͺœ Steps To Reproduce

  1. Open Gitify -> notification icons are missing their color
  2. Click the reload notifications button -> notifications do now have their color

β„Ή System Info

`main` branch

πŸ“Έ Screenshots

On first load:
image

After clicking reload:
image