-
Notifications
You must be signed in to change notification settings - Fork 138
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
Crash When Showing but No Active Hover: Cannot read properties of null (reading 'data') #184
Comments
Thanks for reporting the issue. Your suggested change seems like a good sanity check, but I'm hesitant to make such a change without first understanding the root cause. A situation where PowerTip believes that a tooltip is open but doesn't know of any element that triggered it could cause other problems. Adding a sanity check like this could mask a more fundamental bug and make it harder to find the root cause in the future if someone runs into a different side-effect of the same root problem. So my goal would be to prevent it from getting in this unexpected state in the first place. A couple requests:
I'm interested in seeing the code used so I can better understand the paths that are being followed and how state is being changed along the way. It would also help me debug if you could answer these questions:
|
Hi, Steven, it took some time to get back to this. Video summaryI created a 2:00 video that should hopefully answer these questions and more: https://www.youtube.com/watch?v=gTexPznr8KY Link to the page in question: https://www.docketalarm.com/cases/Michigan_Eastern_District_Court/1--20-cv-13025/B%26P_Littleford_LLC_v._Prescott_Machine_LLC_et_al/ Answers to your questions.
Follow-UpI realize that this issue may be a duplicate, of the much older #169 |
Hi Steven, I have an easier way to reproduce:
Unfortunately, the production page is minified and does not have debug info, so the callstack is unreadable, but it is the same as the callstack shown in the video with the debug info. |
Thank you for the additional information. That was very helpful. Especially the example link and video. I really appreciate you putting in the effort to put all of that together for me. The critical piece of information was that tooltips are being hidden then immediately shown again in the same function (your I believe that I have found the issue. Test casePlease try out my reduced test case to see if this matches the issue that you had been seeing: IssueIt appears that the PowerTip state can be put in an unexpected state if the API I am able to reproduce this issue by rapidly showing and hiding a tooltip multiple times in quick succession. The linked test case demonstrates the minimum action needed to trigger this issue. Repro steps
Repro rate is 100% in this case. For both Firefox and Chromium. This cannot be reproduced if DiagnosisThis is basically a race condition. I was able to determine that it is possible for the Flow
RemedyI think that the bug here is that opening tooltips is part of jQuery's A simple patch can make the diff --git a/src/tooltipcontroller.js b/src/tooltipcontroller.js
index 136c696..3ca1eec 100644
--- a/src/tooltipcontroller.js
+++ b/src/tooltipcontroller.js
@@ -171,12 +173,26 @@ function TooltipController(options) {
});
}
+ /**
+ * Queues up the hideTip function.
+ * @private
+ * @param {jQuery} element The element with the tooltip to hide.
+ */
+ function beginHideTip(element) {
+ // hide tooltip, asap
+ tipElement.queue(function queueTipHide(next) {
+ hideTip(element);
+ next();
+ });
+ }
+
/**
* Hides the tooltip.
* @private
@@ -415,6 +432,6 @@ function TooltipController(options) {
// expose methods
this.showTip = beginShowTip;
- this.hideTip = hideTip;
+ this.hideTip = beginHideTip;
this.resetPosition = positionTipOnElement;
} I suspect that this patch would fix the issue that you've been seeing. Could you give it a try? |
Hi @stevenbenner, Apologies on the long iteration times. I applied your patch, removed my null checks, and unfortunately, I still see the exception. Screenshot of New Crash![]() Notes on Screenshot
|
I came across a crash while hovering over a number of items that have powertips. This is some sort of open/close race condition, because it doesn't happen often, although I can reproduce it somewhat easily.
The error message is:
Cannot read properties of null (reading 'data')
The image below illustrates the moment of the crash, the tip is open, but there is no active hover. Can it simply be fixed by changing:
to
Using version 1.3.2
Callstack
The text was updated successfully, but these errors were encountered: