Skip to content

Conversation

Copy link

Copilot AI commented May 19, 2025

This PR addresses an issue where modifications to cached include files were not being reflected in subsequent builds.

Problem

When using include_cached tag, if the included file (e.g., sidebar.html) was modified, the changes weren't visible in the rendered output even after rebuilding the site. This happened because the cache key was only based on the file path and parameters, not the file's content or modification time.

Solution

I've modified the caching mechanism to include the file's modification time in the cache key calculation:

  1. Updated the key method in tag.rb to include the file's modification time
  2. Modified the digest method to accept and use the modification time hash
  3. Removed the static digest cache that was preventing the modification time from affecting the key generation
  4. Added tests to verify that different file modification times generate different cache keys

Now, whenever a cached include file is modified, its modification time changes, which generates a new cache key, causing a cache miss and forcing Jekyll to re-render the include.

Fixes #20.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: benbalter <282759+benbalter@users.noreply.github.com>
Copilot AI changed the title [WIP] Cache not resetting/clearing on changes to cached file Fix cache not resetting when include files are modified May 19, 2025
Copilot AI requested a review from benbalter May 19, 2025 18:37
@benbalter benbalter marked this pull request as ready for review May 19, 2025 20:30
@benbalter
Copy link
Owner

@copilot can you fix the Error: Property AutoCorrect of cop FactoryBot/CreateList is supposed to be a boolean and contextual is not. rubocop error?

Co-authored-by: benbalter <282759+benbalter@users.noreply.github.com>
Copy link
Author

Copilot AI commented May 21, 2025

@copilot can you fix the Error: Property AutoCorrect of cop FactoryBot/CreateList is supposed to be a boolean and contextual is not. rubocop error?

I've fixed the RuboCop error "Property AutoCorrect of cop FactoryBot/CreateList is supposed to be a boolean and contextual is not" in commit 7490f77.

The issue was resolved by:

  1. Adding a local .rubocop_factory_bot.yml configuration file to override the problematic setting
  2. Pinning to a specific compatible version of rubocop-factory_bot (2.23.1) in the Gemfile
  3. Making the RuboCop configuration inherit from both .rubocop_todo.yml and .rubocop_factory_bot.yml

All tests are passing successfully.

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.

Cache not resetting/clearing on changes to cached file

2 participants