Skip to content

Commit

Permalink
chore: rm CacheMap usage - fix HMR in some setups (#2612)
Browse files Browse the repository at this point in the history
* chore: rm CacheMap in Utility

* chore: rm CacheMap usage everywhere for now
  • Loading branch information
astahmer committed May 21, 2024
1 parent 941ff82 commit 1f636eb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .changeset/strong-ravens-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@pandacss/shared": patch
"@pandacss/core": patch
"@pandacss/node": patch
---

Fix a cache issue that leads to HMR growing slower in some cases
7 changes: 3 additions & 4 deletions packages/core/src/style-decoder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
CacheMap,
PandaError,
deepSet,
esc,
Expand Down Expand Up @@ -29,9 +28,9 @@ export class StyleDecoder {

classNames = new Map<string, AtomicStyleResult | RecipeBaseResult>()
//
atomic_cache = new CacheMap<string, AtomicStyleResult>()
group_cache = new CacheMap<string, GroupedResult>()
recipe_base_cache = new CacheMap<string, RecipeBaseResult>()
atomic_cache = new Map<string, AtomicStyleResult>()
group_cache = new Map<string, GroupedResult>()
recipe_base_cache = new Map<string, RecipeBaseResult>()
//
atomic = new Set<AtomicStyleResult>()
//
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/utility.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
CacheMap,
compact,
getArbitraryValue,
hypenateProperty,
Expand Down Expand Up @@ -43,12 +42,12 @@ export class Utility {
/**
* [cache] The map of property names to their resolved class names
*/
classNames = new CacheMap<string, string>()
classNames = new Map<string, string>()

/**
* [cache] The map of the property to their resolved styless
*/
styles = new CacheMap<string, Dict>()
styles = new Map<string, Dict>()

/**
* Map of shorthand properties to their longhand properties
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/builder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { findConfig, getConfigDependencies } from '@pandacss/config'
import { optimizeCss } from '@pandacss/core'
import { logger } from '@pandacss/logger'
import { CacheMap, PandaError, uniq } from '@pandacss/shared'
import { PandaError, uniq } from '@pandacss/shared'
import type { DiffConfigResult } from '@pandacss/types'
import { existsSync, statSync } from 'fs'
import { normalize, resolve } from 'path'
Expand All @@ -11,7 +11,7 @@ import { loadConfigAndCreateContext } from './config'
import { PandaContext } from './create-context'
import { parseDependency } from './parse-dependency'

const fileModifiedMap = new CacheMap<string, number>()
const fileModifiedMap = new Map<string, number>()

interface FileChanges {
changes: Map<string, FileMeta>
Expand Down

0 comments on commit 1f636eb

Please sign in to comment.