-
Notifications
You must be signed in to change notification settings - Fork 417
Glimpse not detecting ajax request done in $(document).ready() #397
Comments
Just wondering where Glimpse is not detecting this? I am guessing that you aren't seeing it show up in HUD and that if you went to the Ajax tab you would see it there? If this is correct, unfortunately this could be a timing thing. HUD currently only wires itself in on Let me know if this looks like what you are seeing. |
Yes this happens in the HUD, sorry for not mentioning that. |
Could the |
Yep thats exactly what is happening. It is possible to capture some more scenarios than what we are getting now. To do so, we would need to Glimpse would setup a buffer to start catching any requests that occur prior to this, but that isn't there currently. |
@avanderhoorn, when you say Glimpse would need to buffer, does that mean:
Or something else? |
@nikmd23 Both. At the moment we capture the request as its happening and when its finished, render it to the DOM. The problem with this approach is that if the HUD DOM isn't ready, because we are catching requests in flight, we have no where to put it. The proposed change would mean that instead of losing the request in this case, we would put the request data into a buffer/array and when the HUD DOM is ready, it would look to see if there is anything in the buffer and if so render those requests straight away. From then on in, we would render to the DOM like we do at the moment. Does that make sense? |
Yep, got it now! Thanks |
I would like to work on this issue. Suggestions about a starting point, please? |
@umairishaq sounds good to me. So there are a couple of things that will need to be looked at:
|
Thanks @umairishaq! |
You can execute an ajax request at anytime, so the only real way to capture all requests is to do some initialization at the top of the file that is guaranteed to be the first thing executed. The first valid place for this is as the first child of the |
@NickLarsen Agreed with this. Glimpse v2 will do things differently on this front. Hence making sure we can capture everything that happens. |
Note, if someone wants to make the change for the v1 client, I'm happy to help with the effort. |
@avanderhoorn, I've been tinkering with this issue for v1. My thoughts are to attach the ajax listener in a separate script loaded somewhere in the document head. The listener will reference the pubsub module and a stub will be included to queue up requests until the glimpse client is loaded. Once the glimpse client is loaded, the stub pubsub is replaced and queued messages are delivered as the corresponding subscriptions are registered. I've made these changes to the client (including a new glimpse.head.js file) here: https://github.com/mpetito/Glimpse.Client/commit/2ba16d2502c463a1381c1091f6b4563574da11cf I've tested these changes by modifying the glimpse.js resource in One potential issue with this approach is that ajax requests initiated after the pubsub module loads, but before the hud module's I'm also not sure how best to include the new glimpse.head.js file in the document head. |
Glimpse is not detecting the ajax requests made in $(document).ready(). If I trigger the same ajax request for example with button everything is detected as it should.
The text was updated successfully, but these errors were encountered: