Skip to content

[Snyk] Upgrade styled-components from 6.2.0 to 6.3.8#1884

Closed
madhavilosetty-intel wants to merge 1 commit intomainfrom
snyk-upgrade-307cd46a1750bbc36d7199d63d03e6e6
Closed

[Snyk] Upgrade styled-components from 6.2.0 to 6.3.8#1884
madhavilosetty-intel wants to merge 1 commit intomainfrom
snyk-upgrade-307cd46a1750bbc36d7199d63d03e6e6

Conversation

@madhavilosetty-intel
Copy link
Contributor

snyk-top-banner

Snyk has created this PR to upgrade styled-components from 6.2.0 to 6.3.8.

ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


  • The recommended version is 14 versions ahead of your current version.

  • The recommended version was released a month ago.

Release notes
Package name: styled-components
  • 6.3.8 - 2026-01-16

    Patch Changes

    • 55d05c1: Make react-dom an optional peer dependency, clean up some unnecessary type peers.
  • 6.3.7 - 2026-01-16

    Patch Changes

    • 51ffa9c: Fix createGlobalStyle compatibility with React StrictMode and RSC

      This fix addresses issues where global styles would disappear or behave incorrectly in React StrictMode and RSC:

      1. Static styles optimization: Static global styles (without props/interpolations) are now only injected once and won't be removed/re-added on every render. This prevents the style flickering that could occur during concurrent rendering.

      2. StrictMode-aware cleanup: Style cleanup now uses queueMicrotask to coordinate with React's effect lifecycle. In StrictMode's simulated unmount/remount cycle, styles are preserved. On real unmount, styles are properly removed.

      3. RSC compatibility: Move useRef inside RSC guard in createGlobalStyle and unify all useContext calls to use consistent !IS_RSC ? pattern.

      4. RSC inline style tag cleanup: Fix bug where server-defined createGlobalStyle rendered in client components would leave behind accumulated SSR-rendered inline <style data-styled-global> tags. The cleanup effect now removes these hoisted style tags when the component unmounts or re-renders with different CSS.

      These changes ensure createGlobalStyle works correctly with:

      • React StrictMode's double-render behavior
      • React 18/19's concurrent rendering features
      • React 19's style hoisting with the precedence attribute
      • React Server Components (server-defined GlobalStyles in client components)
    • 51ffa9c: Restore styled.br.

    • 1f794b7: Add package.json "exports" field for better native ESM integration.

  • 6.3.7-prerelease.3 - 2026-01-14
  • 6.3.7-prerelease.2 - 2026-01-13
  • 6.3.7-prerelease.1 - 2026-01-13
  • 6.3.7-prerelease.0 - 2026-01-13
  • 6.3.6 - 2026-01-13

    Patch Changes

    • 189bc17: Fix url() CSS function values being incorrectly stripped when using unquoted URLs containing // (e.g., url(https://example.com)). The // in protocol URLs like https://, http://, file://, and protocol-relative URLs was incorrectly being treated as a JavaScript-style line comment.
  • 6.3.5 - 2026-01-11

    Patch Changes

    • 7ff7002: Fix: Line comments (//) in multiline CSS declarations no longer cause parsing errors (fixes #5613)

      JS-style line comments (//) placed after multiline declarations like calc() were not being properly stripped, causing CSS parsing issues. Comments are now correctly removed anywhere in the CSS while preserving valid syntax.

      Example that now works:

      const Box = styled.div`
        max-height: calc(100px + 200px + 300px); // This comment no longer breaks parsing
        background-color: green;
      `;
    • 7ff7002: Fix: Contain invalid CSS syntax to just the affected line

      In styled-components v6, invalid CSS syntax (like unbalanced braces) could cause all subsequent styles to be ignored. This fix ensures that malformed CSS only affects the specific declaration, not subsequent valid styles.

      Example that now works:

      const Circle = styled.div`
        width: 100px;
        line-height: ${() => '14px}'}; // ⛔️ This malformed line is dropped
        background-color: green; // ✅ Now preserved (was ignored in v6)
      `;
  • 6.3.4 - 2026-01-11

    Patch Changes

    • 8e8c282: Fixed createGlobalStyle to not use useLayoutEffect on the server, which was causing a warning and broken styles in v6.3.x. The check typeof React.useLayoutEffect === 'function' is not reliable for detecting server vs client environments in React 18+, so we now use the __SERVER__ build constant instead.
  • 6.3.3 - 2026-01-10

    Patch Changes

    • 6e4d1e7: fix: suppress false "created dynamically" warnings in React Server Components

      The dynamic creation warning check now properly detects RSC environments and skips validation when IS_RSC is true. This eliminates false warnings for module-level styled components in server components, which were incorrectly flagged due to RSC's different module evaluation context. Module-level styled components in RSC files no longer trigger warnings since they cannot be created inside render functions by definition.

  • 6.3.2 - 2026-01-10

    Patch Changes

    • a4b4a6b: fix: include TypeScript declaration files in npm package

      Fixed Rollup TypeScript plugin configuration to override tsconfig.json's noEmit setting, ensuring TypeScript declaration files are generated during build.

    • a4b4a6b: fix: resolve TypeScript error blocking type declaration emission

      Fixed TypeScript error in StyledComponent when merging style attributes from attrs. Added explicit type cast to React.CSSProperties to safely merge CSS property objects. This error was preventing TypeScript declaration files from being generated during build.

  • 6.3.1 - 2026-01-10

    Patch Changes

    • 046e880: Ensure TypeScript declaration files are included in npm package, needed to tweak a Rollup setting.
  • 6.3.0 - 2026-01-10

    Minor Changes

    • 28fd502: Add React Server Components (RSC) support

      styled-components now automatically detects RSC environments and handles CSS delivery appropriately:

      • No 'use client' directive required: Components work in RSC without any wrapper or directive
      • Automatic CSS injection: In RSC mode, styled components emit inline <style> tags that React 19 automatically hoists and deduplicates
      • Zero configuration: Works out of the box with Next.js App Router and other RSC-enabled frameworks
      • Backward compatible: Existing SSR patterns with ServerStyleSheet continue to work unchanged

      RSC best practices:

      • Prefer static styles over dynamic interpolations to avoid serialization overhead
      • Use data attributes for discrete variants (e.g., &[data-size='lg'])
      • CSS custom properties work perfectly in styled-components, can be set via inline style, and cascade to children:
      const Container = styled.div``;
      const Button = styled.button</span> <span class="pl-s"> background: var(--color-primary, blue);</span> <span class="pl-s">;

      // Variables set on parent cascade to all DOM children
      <Container style={{ '--color-primary': 'orchid' }}>
      <Button>Inherits orchid background</Button>
      </Container>;

      • Use build-time CSS variable generation for theming since ThemeProvider is a no-op in RSC

      Technical details:

      • RSC detection via typeof React.createContext === 'undefined'
      • ThemeProvider and StyleSheetManager become no-ops in RSC (children pass-through)
      • React hooks are conditionally accessed via runtime guards
      • CSS is retrieved from the StyleSheet Tag for inline delivery in RSC mode
    • 856cf06: feat: update built-in element aliases to include modern HTML and SVG elements

      Added support for modern HTML and SVG elements that were previously missing:

      HTML elements:

      • search - HTML5 search element
      • slot - Web Components slot element
      • template - HTML template element

      SVG filter elements:

      • All fe* filter primitive elements (feBlend, feColorMatrix, feComponentTransfer, etc.)
      • clipPath, linearGradient, radialGradient - gradient and clipping elements
      • textPath - SVG text path element
      • switch, symbol, use - SVG structural elements

      This ensures styled-components has comprehensive coverage of all styleable HTML and SVG elements supported by modern browsers and React.

    Patch Changes

    • 418adbe: fix(types): add CSS custom properties (variables) support to style prop

      CSS custom properties (CSS variables like --primary-color) are now fully supported in TypeScript without errors:

      • .attrs({ style: { '--var': 'value' } }) - CSS variables in attrs
      • <Component style={{ '--var': 'value' }} /> - CSS variables in component props
      • Mixed usage with regular CSS properties works seamlessly
    • aef2ad6: Update shared css property handling tools to latest versions.

  • 6.2.1-prerelease.0 - 2026-01-06
  • 6.2.0 - 2026-01-06
from styled-components GitHub release notes

Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

Snyk has created this PR to upgrade styled-components from 6.2.0 to 6.3.8.

See this package in npm:
styled-components

See this project in Snyk:
https://app.snyk.io/org/mlosetty-intel/project/0368af3b-6aa8-4238-adce-7aa300a44542?utm_source=github&utm_medium=referral&page=upgrade-pr
@madhavilosetty-intel madhavilosetty-intel deleted the snyk-upgrade-307cd46a1750bbc36d7199d63d03e6e6 branch February 12, 2026 20:17
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