Using Sprig's live search but show all entries first I want to display all results in the games section to start with, then once you search, it shows the filtered results. Sprig's starting point I think assumes that you're showing nothing, like a normal search box.
With the code below, it shows all results to start with - but once there's a search query, it shows the filtered results, then also ALL of the results underneath those. What do I need to change to show all results first and REPLACE them with the filtered results after searching?
It's something to do with the s-target stuff I think. The original loop gets 'moved' into #results when you search, but as I don't understand how Sprig works so I don't really know why it's doing it
{% set queryParams = {} %}
{% set relatedParams = ['and'] %}

{# This is where the query logic is -combining category filters and text search etc #}

{% if sprig.include %}
    &lt;select sprig s-target=&quot;#results&quot; name=&quot;verdict&quot; id=&quot;verdict&quot;&gt;
        {# loop through options #}
    &lt;/select&gt;
    &lt;select sprig s-target=&quot;#results&quot; name=&quot;rating&quot; id=&quot;rating&quot;&gt;
        {# loop through options #}
    &lt;/select&gt;
    &lt;select sprig s-target=&quot;#results&quot; name=&quot;platform&quot; id=&quot;platform&quot;&gt;
        {# loop through options #}
    &lt;/select&gt;
    &lt;input sprig s-trigger=&quot;keyup changed&quot; s-target=&quot;#results&quot; type=&quot;search&quot; name=&quot;title&quot; id=&quot;title&quot; /&gt;
    &lt;div id=&quot;results&quot;&gt;&lt;/div&gt;
{% endif %}

{% if queryParams %}
    {% set entries = craft.entries(queryParams).orderBy('score').all() %}
    {% for entry in entries %}
        {{ entry.title }}
    {% endfor %}
{% else %}
    {% set entries = craft.entries.section('games').orderBy('title').all() %}
    {% for entry in entries %}
        {{ entry.title }}
    {% endfor %}
{% endif %}
Looking at the example from the Sprig Cookbook, it looks like the results container should live outside the sprig.isInclude:
{% if sprig.isInclude %}
    &lt;select sprig s-target=&quot;#results&quot; name=&quot;verdict&quot; id=&quot;verdict&quot;&gt;
        {# loop through options #}
    &lt;/select&gt;
    &lt;select sprig s-target=&quot;#results&quot; name=&quot;rating&quot; id=&quot;rating&quot;&gt;
        {# loop through options #}
    &lt;/select&gt;
    &lt;select sprig s-target=&quot;#results&quot; name=&quot;platform&quot; id=&quot;platform&quot;&gt;
        {# loop through options #}
    &lt;/select&gt;
    &lt;input sprig s-trigger=&quot;keyup changed&quot; s-target=&quot;#results&quot; type=&quot;search&quot; name=&quot;title&quot; id=&quot;title&quot; /&gt;
{% endif %}

&lt;div id=&quot;results&quot;&gt;
{% if queryParams %}
    {% set entries = craft.entries(queryParams).orderBy('score').all() %}
    {% for entry in entries %}
        {{ entry.title }}
    {% endfor %}
{% else %}
    {% set entries = craft.entries.section('games').orderBy('title').all() %}
    {% for entry in entries %}
        {{ entry.title }}
    {% endfor %}
{% endif %}
&lt;/div&gt;