Skip to content

On first load, notification icons are missing colors #786

@adufr

Description

@adufr

🔍 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions