Skip to content

feat: Invalidate elements cache if related object changes#3951

Merged
tvdeyen merged 2 commits into
mainfrom
invalidate-element-cache-job
Jun 10, 2026
Merged

feat: Invalidate elements cache if related object changes#3951
tvdeyen merged 2 commits into
mainfrom
invalidate-element-cache-job

Conversation

@tvdeyen

@tvdeyen tvdeyen commented Jun 10, 2026

Copy link
Copy Markdown
Member

What is this pull request for?

Add a after_touch callback to RelatableResurce that enqueues a job that invalidates the element and page caches for
ingredients having this object assigned as related_object.

So, when a page or node changes the elements and pages get touched as well.

Taken from alchemy-solidus extension, but actually useful for all related objects.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@tvdeyen tvdeyen added this to the 8.3 milestone Jun 10, 2026
@tvdeyen tvdeyen requested a review from a team as a code owner June 10, 2026 17:15
@tvdeyen tvdeyen added the enhancement New feature or enhancement label Jun 10, 2026
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.16%. Comparing base (37a0900) to head (7ee6c4c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3951   +/-   ##
=======================================
  Coverage   98.16%   98.16%           
=======================================
  Files         343      344    +1     
  Lines        8919     8953   +34     
=======================================
+ Hits         8755     8789   +34     
  Misses        164      164           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

tvdeyen added 2 commits June 10, 2026 19:44
Add a after_touch callback to RelatableResurce that enqueues a job that
invalidates the element and page caches for
ingredients having this object assigned as related_object.

So, when a page or node changes the elements and pages get touched as well.

Taken from alchemy-solidus extension, but actually useful for all
related objects.
These are useful defaults recommended by Rails.
@tvdeyen tvdeyen force-pushed the invalidate-element-cache-job branch from d3c4594 to 7ee6c4c Compare June 10, 2026 17:44
@tvdeyen tvdeyen merged commit d7c851b into main Jun 10, 2026
28 checks passed
@tvdeyen tvdeyen deleted the invalidate-element-cache-job branch June 10, 2026 17:55
@alchemycms-bot alchemycms-bot Bot mentioned this pull request Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants