Skip to content

Theme filtering incorrectly matches partial theme names when only one is specified in staticCss.themes #3250

Closed
@kris-ellery

Description

@kris-ellery

Description

When creating themes variants with similar names (like design and design-legacy) but only pre-generating design in the staticCss.themes array, the build tool incorrectly processes both variants instead of only the specified one.

Link to Reproduction

https://play.panda-css.com/41FTSkx0R0

Steps to reproduce

  1. Go to https://play.panda-css.com/41FTSkx0R0
  2. Go to Config tab
  3. Verify themes variants, design and design-legacy
  4. Verify staticCss.themes only has design to pre-generate tokens
  5. Open CSS and Tokens tab a the bottom
  6. See how both variants are pre-generated
  7. If you were to swap design for design-legacy in staticCss.themes, it would only generate design-legacy tokens.

JS Framework

React 18

Panda CSS Version

0.53.6

Browser

Latest Chrome

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

I believe the issue is somewhere in this file when it uses .some and .startsWith methods.

https://github.com/chakra-ui/panda/blob/9453c9b8e5957b34efe9711c528a0d37b81025c0/packages/generator/src/artifacts/css/token-css.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions