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

Encapsulate stale_when_importmap_changes method #284

Merged
merged 2 commits into from
Dec 21, 2024

Conversation

dhh
Copy link
Member

@dhh dhh commented Dec 20, 2024

Most Rails applications use etags to some extent. We should therefore make it the default to include the importmap digest in that calculation on HTML requests. So we turn:

class ApplicationController < ActionController::Base
  etag { Rails.application.importmap.digest(resolver: helpers) if request.format&.html? }
end

...into:

class ApplicationController < ActionController::Base
  stale_when_importmap_changes
end

And we can add that add that to be part of the default ApplicationController in Rails when using import maps.

@dhh dhh merged commit 2ef81f0 into main Dec 21, 2024
40 of 44 checks passed
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.

1 participant