When using HTTPFox plugin for FF I noticed that after each add to cart action my browser receives 2 portions of content from server:
1) Cart block content, from /uc_ajax_cart/show
2) Cart form content, from /uc_ajax_cart/show-cart-view
It is natural for browser to query the first portion – new state of cart block must be presented to a customer after a product has been added to the cart. But why query the second one? When a customer browses catalog and adds something to the cart, there is no cart form (uc_cart_view_form) on the page, so why reload it?
After investigating code in uc_ajax_cart.js I found that the problem is in the function named ajaxCartReloadCartView().
Actually the fact is that this function is used not only after adding new products to cart, but also after updating the cart on the cart view page (/cart). In the latter case everything is OK, no unnecessary actions are taken. But in all other cases reloading uc_cart_view_form is redundant.
The attached patch avoids reloading of the cart form when it is not found on the current page.