3

That's a lot of code to post in a question! The basic gist is that instead of merging new related params with relatedParams|merge and then applying to the query, you can call andRelatedTo(newParams) directly on the query. {% set productsQuery = craft.products %} {% set someEntryId = craft.app.request.queryParam('someEntryId') %} {# BEFORE #} {% if ...


3

This is oddly similar to this question. The problem is that your Sprig component includes the wrapper (the div with the masonry class), so reloading the Sprig component not only replaces the items, but also the wrapper itself. Masonry keeps a reference to this wrapper (the element masonry was initialized with) and uses it to find new children. Since the ...


2

My suggestion would be to give the Select All Values checkbox a unique name. That way, you can easily detect whether it was selected or not. You should also break dropdown_field out into 2 variables to avoid confusion. {% set select_all_values = select_all_values ?? false {% set dropdown_field_options = ['dropdown_value_1', 'dropdown_value_2', '...


2

The problem that you expect your qty variable to be an array of guests and initialize it like that, but once you set a quantity it will be an integer, so the loop won't work correctly. See this line: {% set qty = qty ?? [['']] %} This initializes qty to an array containing another array containing an empty string (by the way, why do you need the nested ...


2

I ended up using the following code - I just didn't come up with it earlier. I had to index the newsCat array used to denominate the single checkbox names. {% set newsCat = newsCat ?? '' %} {% set relatedTo = newsCat|join(',') %} {% set entryQuery = craft.entries .section('news') .limit(5) .relatedTo(relatedTo) %} {% for category in craft....


2

Checkbox input field names should be in array format (not specific to Sprig), so I expect this should work. <input sprig type="checkbox" class="filter_checkbox" name="newsCat[]" id="checkbox_{{ category.id }}" value="{{ category.id }}" {{ category.id in newsCat ? 'checked' : '' }}>


2

Do you get any error messages in the console? This will tell you what's going wrong with Swiper internally. Educated guess: Swiper probably stores some state with references to existing DOM nodes / cards. When sprig re-renders an element, it completely replaces the subtree in its scope, so this will invalidate the state stored in the Swiper instance. You ...


2

Because of your component's element structure this is slightly more complex. I just added a new recipe to the Sprig cookbook called "Load More Complex" which should provide you with the solution, although you may want to move the button outside of the #results div. https://putyourlightson.com/sprig/cookbook#load-more-complex


2

Sprig will use whatever your site's base URL is set to, to construct the action URL. Ensure in Settings → Sites that the base URL is either set to an absolute path starting with https://, or if an alias or environment variable, that it is defined as an absolute path starting with https://. Also be sure to either force the www subdomain or force a naked ...


1

Duplicate of https://github.com/putyourlightson/craft-sprig/issues/118 The code is correct and what you are experiencing is likely due to local browser caching.


1

Turns out the error was elsewhere in the template where I had forgotten to add the .all() statement. The code in the example is error free.


1

One thing that stands out is that you're checking myQuery | length instead of items | length. Though I've tested it and this doesn't actually cause a deprecation error in my setup. Have you tried clearing the deprecation warnings in the backend manually? They won't disappear automatically if you change the template, but will stay visible until cleared ...


1

You need to apply the category filter to the entry query. {% set categoryId = categoryId ?? '' %} {% set entryQuery = craft.entries ({ search: search, section: 'articles', limit: 2, relatedTo: categoryId, }) %} And also update the select field to match. <select sprig name="categoryId" id="category" value="{{ ...


Only top voted, non community-wiki answers of a minimum length are eligible