Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
There was a problem hiding this comment.
Pull request overview
This PR modernizes the repo’s tooling (CI, linting, dependencies) and refactors the library’s caching/rendering flow by introducing a useInlineSVG hook and a context-based CacheProvider, with accompanying test/fixture updates and documentation improvements.
Changes:
- Replaced the legacy GitHub Actions workflow with a new CI workflow and updated tooling versions.
- Refactored
InlineSVGto use a newuseInlineSVGhook and moved persistent caching to aCacheProvider/context model. - Enhanced SVG ID uniquification to also rewrite
#idreferences inside<style>elements; updated fixtures/snapshots/tests accordingly.
Reviewed changes
Copilot reviewed 24 out of 28 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/ci.yml | New CI workflow definition for validation + publish jobs. |
| vitest.config.mts | Coverage configuration update (including removal of coverage.all). |
| eslint.config.mjs | New flat ESLint config replacing package.json inline config. |
| package.json | Dependency/tooling upgrades and config cleanup. |
| src/index.tsx | Refactor to useInlineSVG + context-aware cache store selection. |
| src/provider.tsx | New CacheProvider using React context to provide a persistent CacheStore. |
| src/modules/useInlineSVG.ts | New hook implementing the component’s state machine + fetch/caching flow. |
| src/modules/utils.ts | New logic to uniquify IDs referenced inside <style> blocks. |
| src/modules/cache.ts | CacheStore API updated to accept options and support persistent cache without globals. |
| src/types.ts | Expanded prop/type documentation comments. |
| test/* | Updated tests for new cache semantics, new fixture, and new race/sequential src-change scenarios. |
| test/fixtures/styles_with_ids.svg | New fixture for validating ID rewrites in <style> blocks. |
| README.md / CLAUDE.md | Documentation updates reflecting new usage/caching model and architecture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1ff4014 to
db30c89
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 28 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 28 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
test/unsupported.spec.tsx:32
- The ESLint disable is masking an unused destructured parameter (
onLoad) that isn't used in the helper. Prefer removingonLoadfrom the destructuring (or wiring it through) so the test helper signature stays accurate without suppressing lint.
// eslint-disable-next-line unused-imports/no-unused-vars
function setup({ onLoad, src = 'http://localhost:1337/play.svg', ...rest }: Partial<Props> = {}) {
return render(
<InlineSVG loader={<Loader />} onError={mockOnError} onLoad={mockOnLoad} src={src} {...rest} />,
);
test/index.spec.tsx:61
- The ESLint disable is masking an unused destructured parameter (
onLoad) insetup. Prefer removingonLoadfrom the destructuring (or using it) instead of suppressingno-unused-varsfor the next line.
// eslint-disable-next-line unused-imports/no-unused-vars
function setup({ onLoad, ...rest }: Props) {
return render(
<ReactInlineSVG loader={<Loader />} onError={mockOnError} onLoad={mockOnLoad} {...rest} />,
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- replace external flow with a React context - improve caching logic - fix initial state - update cache onReady method to return unsubscribe function
- fix sequential src changes - fix onLoad isCached parameter to report the actual cache hit status
- add CLAUDE.md - replace references to svgporn.com with svglogos.dev
- remove codesandbox ci
|



This pull request modernizes and improves the project's development workflow, documentation, and dependencies. The main changes include migrating CI to GitHub Actions with updated workflows, upgrading dependencies (including React 19), enhancing documentation with a new architecture overview, and cleaning up outdated configuration files.
CI/CD and Workflow Improvements:
.github/workflows/main.ymlto a new, modular.github/workflows/ci.ymlusing updated actions, Node 24, pnpm 10, and improved job separation for validation and publishing. Adds SonarQube scanning and proper concurrency handling. [1] [2].codesandbox/ci.jsonconfiguration as it's no longer needed.Dependency and Tooling Upgrades:
package.jsonanddemo/package.json. [1] [2]eslint.config.mjs) for improved linting and testing rules, removing the old inline config frompackage.json. [1] [2]Documentation Enhancements:
CLAUDE.mdwith an overview of the project's architecture, commands, core modules, caching, and testing strategy.README.mdwith clearer prop documentation, updated usage examples, corrected URLs, clarified SSR and caching behavior, and fixed minor typos and formatting. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Demo and Example Updates:
svglogos.devinstead ofsvgporn.com) and upgraded demo dependencies to match the main package. [1] [2] [3]These changes collectively modernize the codebase, improve developer experience, and provide clearer guidance for users and contributors.