Skip to content

Commit 89c3835

Browse files
committed
Remove invalidation count check
1 parent dc7b00a commit 89c3835

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

src/lib/setupContextUtils.js

-2
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,6 @@ export function createContext(tailwindConfig, changedContent = [], root = postcs
791791
let resolvedPlugins = resolvePlugins(context, root)
792792
registerPlugins(resolvedPlugins, context)
793793

794-
sharedState.contextInvalidationCount++
795-
796794
return context
797795
}
798796

src/lib/sharedState.js

-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ export const env = {
55
export const contextMap = new Map()
66
export const configContextMap = new Map()
77
export const contextSourcesMap = new Map()
8-
/**
9-
* A map of source files to their sizes / hashes
10-
*
11-
* @type {Map<string, string>}
12-
*/
138
export const sourceHashMap = new Map()
14-
export const contextInvalidationCount = 0
159
export const NOT_ON_DEMAND = new String('*')
1610

1711
export function resolveDebug(debug) {

tests/context-reuse.test.js

-35
Original file line numberDiff line numberDiff line change
@@ -125,38 +125,3 @@ it('updates layers when any CSS containing @tailwind directives changes', async
125125
}
126126
`)
127127
})
128-
129-
it('invalidates the context when any CSS containing @tailwind directives changes', async () => {
130-
sharedState.contextInvalidationCount = 0
131-
sharedState.sourceHashMap.clear()
132-
133-
// Save the file a handful of times with no changes
134-
// This builds the context at most once
135-
for (let n = 0; n < 5; n++) {
136-
await run(`@tailwind utilities;`, configPath, `id=1`)
137-
}
138-
139-
expect(sharedState.contextInvalidationCount).toBe(1)
140-
141-
// Save the file twice with a change
142-
// This should rebuild the context again but only once
143-
await run(`@tailwind utilities; .foo {}`, configPath, `id=1`)
144-
await run(`@tailwind utilities; .foo {}`, configPath, `id=1`)
145-
146-
expect(sharedState.contextInvalidationCount).toBe(2)
147-
148-
// Save the file twice with a content but not length change
149-
// This should rebuild the context two more times
150-
await run(`@tailwind utilities; .bar {}`, configPath, `id=1`)
151-
await run(`@tailwind utilities; .baz {}`, configPath, `id=1`)
152-
153-
expect(sharedState.contextInvalidationCount).toBe(4)
154-
155-
// Save a file with a change that does not affect the context
156-
// No invalidation should occur
157-
await run(`.foo { @apply mb-1; }`, configPath, `id=2`)
158-
await run(`.foo { @apply mb-1; }`, configPath, `id=2`)
159-
await run(`.foo { @apply mb-1; }`, configPath, `id=2`)
160-
161-
expect(sharedState.contextInvalidationCount).toBe(4)
162-
})

0 commit comments

Comments
 (0)