-
Notifications
You must be signed in to change notification settings - Fork 55
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
Improve notification id #174
Merged
spadgett
merged 1 commit into
openshift:master
from
benjaminapetersen:bpeterse/notification-id
Sep 7, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjaminapetersen This has already merged, but I realize we can't use
notification.id
if set by the caller fortrack by
because it won't always be unique. For some messages, we purposely reusenotification.id
so they don't get toasted twice.We probably need to always generated some of unique ID that is set by the service and is always unique. So this might need to be.
Then we can use that always for
track by
. This will also fix an animation issue I've noticed with the toast that the slide in animation is reset for already-visible items when new items are added.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the notification drawer only needs this
uniqueID
, correct?I'm wondering if we can rename the filed that gets reused so we don't double toast. I feel like
id
anduniqueID
is a bit confusing. I imagine this creates more work for us elsewhere.Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to use it for
track by
in the toast notifications as well. We have some animation quirks with the toasts becausetrack by
isn't correct.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming the field will touch dozens of files across all 3 repositories :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boo...
So we provide
uniqueID
and always use that fortrack by
. If the originator of the notification does not setid
, we can safely still use the same generated randomid
for it (like here). Soid
anduniqueID
can match if its irrelevant, correct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's too terrible if we give the new field a very specific name, maybe
trackByID
, and a comment that it's there for uniqueness. What do you think?Yeah, we should always use the unique ID for track by so avoid duplicates in a repeater error. I wouldn't worry about setting
notification.id
if the caller didn't set one.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me! i can open a quick PR to swap this again. 😄