fix: missing icon colors on first load #787
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issues
Context
Show notification icons colors on app first load / app refresh.
Discussion
I've identified 2 possible fixes:
First one would be to simply drop this code so that we fetch the
state
of each notifications, even thoughsettings.colors
is falsy.gitify/src/hooks/useNotifications.ts
Lines 107 to 117 in 1c3c248
Since
notification.state
is, for now, only required to load the icons colors, this would result on making a lot of unnecessary api calls if the setting is disabled.Second one is the one I've implemented: init
settings.colors
to null and explicitely check forsettings.colors === false
, thus fixing the bug AND avoiding making unnecessary api calls