Skip to content

On first load, notification icons are missing colors #786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
adufr opened this issue Feb 18, 2024 · 0 comments · Fixed by #787
Closed
1 task done

On first load, notification icons are missing colors #786

adufr opened this issue Feb 18, 2024 · 0 comments · Fixed by #787
Labels
bug Something isn't working

Comments

@adufr
Copy link
Contributor

adufr commented Feb 18, 2024

🔍 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

@adufr adufr added the bug Something isn't working label Feb 18, 2024
@adufr adufr changed the title On first load, notifications are missing state On first load, notification icons are missing colors Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant