Skip to content

Updates#248

Merged
gilbarbara merged 12 commits intomainfrom
updates
Mar 29, 2026
Merged

Updates#248
gilbarbara merged 12 commits intomainfrom
updates

Conversation

@gilbarbara
Copy link
Copy Markdown
Owner

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:

  • Migrated CI from .github/workflows/main.yml to a new, modular .github/workflows/ci.yml using updated actions, Node 24, pnpm 10, and improved job separation for validation and publishing. Adds SonarQube scanning and proper concurrency handling. [1] [2]
  • Removed the legacy .codesandbox/ci.json configuration as it's no longer needed.

Dependency and Tooling Upgrades:

  • Upgraded core and dev dependencies to latest versions, including React and React DOM 19, TypeScript 5.9, ESLint 9, and other testing/build tools in both package.json and demo/package.json. [1] [2]
  • Switched to a new ESLint configuration file (eslint.config.mjs) for improved linting and testing rules, removing the old inline config from package.json. [1] [2]

Documentation Enhancements:

  • Added a comprehensive CLAUDE.md with an overview of the project's architecture, commands, core modules, caching, and testing strategy.
  • Improved README.md with 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:

  • Updated demo app and documentation examples to use new SVG asset URLs (svglogos.dev instead of svgporn.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.

Copilot AI review requested due to automatic review settings March 29, 2026 13:38
@codesandbox
Copy link
Copy Markdown

codesandbox bot commented Mar 29, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 InlineSVG to use a new useInlineSVG hook and moved persistent caching to a CacheProvider/context model.
  • Enhanced SVG ID uniquification to also rewrite #id references 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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 removing onLoad from 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) in setup. Prefer removing onLoad from the destructuring (or using it) instead of suppressing no-unused-vars for 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
@sonarqubecloud
Copy link
Copy Markdown

@gilbarbara gilbarbara merged commit 3a4c7ae into main Mar 29, 2026
5 checks passed
@gilbarbara gilbarbara deleted the updates branch March 29, 2026 19:34
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