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

Avoid rendering messages with duplicate IDs #387

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

benlangfeld
Copy link
Member

This is motivated by a race condition when loading archived messages (calling Candy.View.Pane.Message.show) at the same time as rendering an incoming message, such as when a 1-on-1 message arrives and auto-opens a new pane for the chat partner.

@@ -89,7 +89,7 @@ Candy.View.Template = (function(self){

self.Message = {
pane: '<div class="message-pane-wrapper"><ul class="message-pane"></ul></div>',
item: '<li><small data-timestamp="{{timestamp}}">{{time}}</small><div>' +
item: '<li data-message-id="{{id}}"><small data-timestamp="{{timestamp}}">{{time}}</small><div>' +
Copy link
Member

Choose a reason for hiding this comment

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

why not just id? might be used for other cases

Copy link
Member Author

Choose a reason for hiding this comment

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

Just to avoid potential colision with any reserved name. Happy to change it if you're confident that data-id is ok. I'm not a front-end guy ;)

Copy link
Member

Choose a reason for hiding this comment

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

I meant just id, not data-id :D but then you'd probably need a message- prefix to avoid collisions..

@coveralls
Copy link

Coverage Status

Coverage remained the same at 56.62% when pulling 9c0fec9 on feature/avoid-duplicate-message-ids into 9cd7022 on dev.

This is motivated by a race condition when loading archived messages (calling Candy.View.Pane.Message.show) at the same time as rendering an incoming message, such as when a 1-on-1 message arrives and auto-opens a new pane for the chat partner.
@bklang bklang force-pushed the feature/avoid-duplicate-message-ids branch from 9c0fec9 to 6a096d0 Compare July 22, 2015 01:31
@benlangfeld benlangfeld modified the milestone: v2.2.0 Aug 12, 2015
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.

3 participants