Skip to content

Fix element cache edge cases - #257

Merged
gilbarbara merged 2 commits into
mainfrom
updates
Nov 3, 2026
Merged

gilbarbara merged 2 commits into
mainfrom
updates

Conversation

@gilbarbara

Copy link
Copy Markdown
Owner
  • Decide whether an instance is cacheable once at mount, the same way its hash is fixed at mount. An instance with uniquifyIDs that got a uniqueHash after mounting wrote entries keyed on its random hash, which nothing could reuse and which pushed useful entries out.
  • Generate the hash only when uniquifyIDs is on. It's unused otherwise.
  • Document that the element cache is shared by all instances and independent of CacheProvider.

Upgrade dependencies and actions

- decide cacheability once at mount, like the hash itself, so an instance
  that gets a uniqueHash later doesn't fill the cache with entries keyed on
  its random hash that nothing can reuse
- generate the hash only when uniquifyIDs is on, since it's unused otherwise
- document that the element cache is shared and independent of CacheProvider
Copilot AI balanced review requested due to automatic review settings November 3, 2026 02:01
@codesandbox

codesandbox Bot commented Nov 3, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web Editor • VS Code • Insiders

Open Preview

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the element-cache eligibility fix and accompanying tooling updates.

No open issues 🎉

What changed in this PR

Fixes element-cache eligibility in react-inlinesvg when uniqueHash changes after mount, while updating development tooling and CI.

Changes:

  • Determines hash stability at mount and generates hashes only when uniquifyIDs is enabled.
  • Adds regression coverage and clarifies the element cache’s shared scope and independence from CacheProvider.
  • Upgrades dependencies, restores Vitest matcher types, pins GitHub Actions, and adds formatting to validation.
File Description
test/​tsconfig.json Includes Node and jest-dom types.
test/​cacheElements.spec.tsx Tests adding uniqueHash after mount.
test/​__setup__/​vitest.setup.ts Restores matcher types for Vitest 5.
src/​types.ts Documents mount-time hash requirements for caching.
src/​modules/​useInlineSVG.ts Fixes hash-stability tracking and avoids unused hash generation.
sonar-project.properties Corrects the Sonar source-directory property.
README.md Clarifies cache behavior and formats documentation.
pnpm-workspace.yaml Raises the Vite override and adds a release-age exclusion.
package.json Upgrades tooling and updates validation scripts.
CLAUDE.md Updates tooling and element-cache guidance.
.github/​workflows/​ci.yml Updates actions and pins them to commit SHAs.
.github/​ISSUE_TEMPLATE/​bug_report.yml Removes trailing whitespace.

Review effort: Balanced

- bump vitest to 5, eslint to 10, jsdom to 30, jest-dom to 7
- restore jest-dom and jest-extended matcher types for vitest 5's Assertion<R, T>
- raise the vite override to 8.3.5 to clear GHSA advisories in <=8.1.5
- pin GitHub Actions to commit SHAs
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@gilbarbara
gilbarbara merged commit 63eb8b3 into main Nov 3, 2026
5 checks passed
@gilbarbara
gilbarbara deleted the updates branch November 3, 2026 04:08
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.

2 participants