Purpose of PageEditorDeferRefresh.js?
(I'm using Coveo for Sitecore 4.0, June release, with Sitecore 8.1 Update 2)
I've been working with the Search components for a while and I stumbled across an issue in Experience Editor. Basically, if I try to add a component to a page that already has a SearchViewResources and SearchBoxView on it (which is every page), the page will not refresh so the component never gets added. I've identified the PageEditorDeferRefresh.js file in the SearchViewResources.cshtml as the culprit.
I've tried commenting it out and Experience Editor starts working normally. I've even tried that when in a search view updating some facets and it's been okay.
So my question is, what am I missing by taking it out?
This file is a "hack" to refresh Coveo components when their properties are being edited in the Experience editor. I do not know what are the effects of removing it: I suppose your Coveo components will not refresh after you edited their properties. I think you should see a couple of JS errors as well when closing your components properties.
Removing it will have no effects on your sites in prod: the file is included only when editing a page in the page editor.
Question to reproduce your issue: The component you are trying to add: is it a Coveo component, something custom? It happens with both?