Maybe I have some misconfig, but it seems that a hx-swap-oob is not respected in a component.
I have a component with a search input field, that is rendered from a parent template. The parent template contains a <div id="patient-search-result"> tag which is empty.
The response looks like (simplified):
{% load tz i18n htmx %}
<div {% hx-tag %}>
<form>
<div class="input-group input-group-sm mb-3">
<input {% on 'search_patient' %} type="text" class="form-control" autofocus>
<button
class="btn btn-primary" id="patient-search-button"
{% on 'search_patient' %}>Search</button>
</div>
</form>
</div>
{# this should be swapped into the #patient-search-result div #}
<div id="patient-search-results" hx-swap-oob="true">
{% for patient in patient_list %}
<strong>{{ patient.names.first.last_name | upper }}</strong>,
{{ patient.names.first.first_name }}
{% endfor %}
</div>
The second div is on the top level of the response, as requested by htmx:
Note that out of band elements must be in the top level of the response, and not children of the top level elements.
But it is not loaded into that div#patient-search-result, but directly after the first div, like in the response.
I looked at the code, and saw that the context "could" have a hx_swap_oob key - but this is not documented and I don't know what to do.
Is this a bug, or just me not knowing what to do here?
Maybe I have some misconfig, but it seems that a
hx-swap-oobis not respected in a component.I have a component with a search input field, that is rendered from a parent template. The parent template contains a
<div id="patient-search-result">tag which is empty.The response looks like (simplified):
The second div is on the top level of the response, as requested by htmx:
But it is not loaded into that
div#patient-search-result, but directly after the first div, like in the response.I looked at the code, and saw that the context "could" have a
hx_swap_oobkey - but this is not documented and I don't know what to do.Is this a bug, or just me not knowing what to do here?