Skip to content

fix(druxt): re-hydrate included resources on getCollection cache hit - #782

Open
Decipher wants to merge 1 commit into
druxt:developfrom
Decipher:feature/781-getcollection-included-cache
Open

fix(druxt): re-hydrate included resources on getCollection cache hit#782
Decipher wants to merge 1 commit into
druxt:developfrom
Decipher:feature/781-getcollection-included-cache

Conversation

@Decipher

@Decipher Decipher commented Aug 16, 2026

Copy link
Copy Markdown
Member

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

addCollection dehydrated included resources into state.resources but then deleted them from the stored collection. So a second getCollection dispatch for an already-cached query returned included: undefined, and anything resolving an included resource, such as an image or media reference, silently got nothing back on the cache hit.

This keeps the dehydrated included refs on the stored collection and reconstructs them on a cache hit, the same way data already is. Includes a changeset.

Resolves: #781

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

Screenshots/Media

N/A

Summary by CodeRabbit

  • Bug Fixes
    • Fixed cached collections so related included resources are preserved and restored correctly.
    • Ensured cached results now match fresh-fetch results, including all associated resource data.

addCollection dehydrated included resources into state.resources but
then deleted them from the stored collection, so a second getCollection
dispatch for an already-cached query returned included: undefined -
silently breaking anything resolving an included resource (e.g. an
image/media reference) on a cache hit.
@changeset-bot

changeset-bot Bot commented Aug 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24b691b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
druxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3303384f-c55f-436c-940c-bf11435fa30b

📥 Commits

Reviewing files that changed from the base of the PR and between 6a59f71 and 24b691b.

📒 Files selected for processing (3)
  • .changeset/lucky-moons-wave.md
  • packages/druxt/src/stores/druxt.js
  • packages/druxt/test/stores/druxt.test.js

Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The Druxt collection cache now preserves dehydrated included resource references and rehydrates them on cache hits. Tests cover the stored references and returned resource shape. A patch changeset documents the fix.

Changes

Collection cache rehydration

Layer / File(s) Summary
Cache storage and rehydration
packages/druxt/src/stores/druxt.js
addCollection retains dehydrated included references. getCollection rehydrates data and included resources on cache hits.
Regression coverage and release metadata
packages/druxt/test/stores/druxt.test.js, .changeset/lucky-moons-wave.md
Tests verify retained included references and cache-hit rehydration. A patch changeset documents the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 24b69

This localized fix restores included resources on cached collection reads without introducing a known user or production risk; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the fix for missing included resources on getCollection cache hits.
Linked Issues check ✅ Passed The changes preserve included resource references and rehydrate them on cache hits, satisfying issue #781.
Out of Scope Changes check ✅ Passed The changes are limited to the cache fix, tests, and its changeset, with no unrelated scope detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

getCollection returns no included data on a cache hit

1 participant