Skip to content

Conversation

@adamjhf
Copy link

@adamjhf adamjhf commented Oct 17, 2025

Description

Fixes #182 by preventing loading-states triggering on preloaded requests.

Htmx version: 2.0.7
Used extension(s) version(s): loading-states 2.0.1, preload 2.1.1

Corresponding issue: #182

Testing

Tested manually by validating loading-data element not visible for preloaded request using example HTML below.

Added new test to validate loading-data display remains none when preloaded request is triggered.

<html>

<head>
	<script src="https://unpkg.com/htmx.org@2.0.7/dist/htmx.min.js"></script>
	<script src="https://unpkg.com/htmx-ext-preload@2.1.1/preload.js"></script>
	<script src="https://unpkg.com/htmx-ext-loading-states@2.0.1/loading-states.js"></script>
	<style>[data-loading] { display: none; }</style>
</head>

<body hx-ext="loading-states,preload">
	<button hx-get="?" preload="mouseover"
		style="display: block; background: blue; color: white; height: 250px; width: 250px;">
		Mouse over to preload
	</button>
	<div data-loading>Loading...</div>
</body>

</html>

Checklist

  • I have read the contribution guidelines
  • I ran the test suite locally (npm run test) and verified that it succeeded

@netlify
Copy link

netlify bot commented Oct 17, 2025

Deploy Preview for htmx-extensions canceled.

Name Link
🔨 Latest commit 5ba562c
🔍 Latest deploy log https://app.netlify.com/projects/htmx-extensions/deploys/68f2c59005886800081c0fb7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loading-states are persisted for preloaded requests

1 participant