Hello all. I updated to the stable release (8.x-1.0), and found that the update breaks my facets' soft-limits. On page load, the soft-limit does not get applied to any facets, causing each facet's full list of options to be shown.

I'm including a patch that resolves the bug for me.

I think the problem is caused by the introduction of facets-views-ajax.js. That file uses jQuery.once() on the facet <li>s to apply click handlers. Meanwhile, soft-limit.js was already using .once() to apply the soft-limit by hiding all the unwanted <li>s.

Since none of the calls to .once() specify a key, all of them default to using "once" as their keys. This causes the soft-limit to not be applied at all, because some other JS using the "once" keyword has already run on those elements.

(For more information about .once() keys, check out the .once() API documentation.)

Giving the soft-limit a unique keyword seems to fix the problem. See the attached patch.

CommentFileSizeAuthor
facets-broken-soft-limit.patch435 bytesivavictoria
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Aurif3x created an issue. See original summary.

borisson_’s picture

Should we do this for all of the .once calls we have, as a more general cleanup, or should we do that as a followup? I'm assuming doing that as a followup will be easier.

  • borisson_ committed d8fcd54 on 8.x-1.x authored by Aurif3x
    Issue #2985159 by Aurif3x: AJAX update breaks soft-limits
    
borisson_’s picture

Status: Needs review » Fixed

We can do this now, and see if we can do others later. Committing this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.