From e1b8c9d261cdc81f448092f5d067811cbaee5884 Mon Sep 17 00:00:00 2001 From: Anh Nhan Nguyen Date: Fri, 5 Apr 2013 16:25:07 -0700 Subject: [PATCH] Fixing a race condition for hovercards Summary: Refs T1048 - Take this setup: D123 D321 Hover with the mouse over one object, and move to another one before it got loaded. You'll have two hovercards. Of these you can't get rid of one anymore. Not through resizing, not through showing another hovercard. (You may have to try a few times). I think it only happens when #2 loads faster than #1. #2 is displayed, then #1 gets loaded and draws. Or something like that. You could have a race condition where one draws after another and overwrites the current node/anchor, without hiding it. This renders the previous card unhideable, even on resize / mouse far away. Test Plan: Did a repro by hovering a lot. Applied this change. Could not repro anymore. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1048 Differential Revision: https://secure.phabricator.com/D5594 --- webroot/rsrc/js/application/core/Hovercard.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webroot/rsrc/js/application/core/Hovercard.js b/webroot/rsrc/js/application/core/Hovercard.js index 5907dd4d21..86dc8d2652 100644 --- a/webroot/rsrc/js/application/core/Hovercard.js +++ b/webroot/rsrc/js/application/core/Hovercard.js @@ -120,6 +120,11 @@ JX.install('Hovercard', { new JX.Request(uri, function(r) { for (var phid in r.cards) { self._cards[phid] = r.cards[phid]; + + if (self.getCard()) { + self.hide(); + } + self._drawCard(phid); } }).send();