Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More explicit explanation of htmx.config.getCacheBusterParam #2376

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

lookbusy1344
Copy link
Contributor

Description

The documentation for htmx.config.getCacheBusterParam can be confusing. Colleagues and I expected an ephemeral timestamp or random number, not the target element id. I have tried to clarify its behaviour in the docs:

Original text is "defaults to false, if set to true htmx will include a cache-busting parameter in GET requests to avoid caching partial responses by the browser"

New text is "defaults to false, if set to true htmx will append the target element to the GET request in the format org.htmx.cache-buster=targetElementId"

For reference the behaviour is implemented here

htmx/src/htmx.js

Line 3204 in ba2c30b

filteredParameters['org.htmx.cache-buster'] = getRawAttribute(target, "id") || "true";

Note the tests are well phrased in this regard

it('includes a cache-busting parameter when enabled w/ the id of the target if there is one', function () {

@Telroshan Telroshan added the documentation Improvements or additions to documentation label Mar 17, 2024
Copy link
Collaborator

@alexpetros alexpetros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great clarification, thank you!

@alexpetros alexpetros merged commit f9591c9 into bigskysoftware:master Apr 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants