Skip to content
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

Only save pending updates for annotations in the focused group #111

Merged
merged 1 commit into from
Sep 16, 2016

Conversation

robertknight
Copy link
Member

Since we discard all pending updates and deletions when switching
groups, discard notifications about annotations in unfocused groups
as soon as we receive them.

This fixes the issue where the 'Apply Update' badge counted updates
from other groups, with the result that clicking the badge did not
show any changes.

Copy link
Contributor

@nickstenning nickstenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this change breaks the behaviour of deletes, which don't carry group information.

Previously, if you created and deleted an annotation in the current group on another page, the delete would clear the pending update. On this branch that no longer happens.

Probably worth adding a test for this scenario.

// Ignore updates to annotations that are not in the focused group
return ann.group === groups.focused().id;
});
annotationMapper.loadAnnotations(Object.values(pendingUpdates));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a tiny tiny thing, but honestly this would be clearer if you stuck to the pattern you had before:

var updates = Object.values(pendingUpdates);
var deletions = ...;

annotationMapper.loadAnnotations(updates);
annotationMapper.unloadAnnotations(deletions);

Since we discard all pending updates and deletions when switching
groups, discard create/update notifications about annotations in
unfocused groups as soon as we receive them.

This fixes the issue where the 'Apply Update' badge counted updates
from other groups, with the result that clicking the badge did not
show any changes.
@robertknight robertknight force-pushed the only-count-updates-from-focused-groups branch from ddafd5d to 3dc467c Compare September 16, 2016 10:43
Copy link
Contributor

@nickstenning nickstenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Delete issue is fixed, and only updates from the focused group are counted.

@nickstenning nickstenning merged commit 72859c5 into master Sep 16, 2016
@nickstenning nickstenning deleted the only-count-updates-from-focused-groups branch September 16, 2016 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants