Skip to content

Commit 220534f

Browse files
authored
Merge pull request #1020 from reduxjs/bugfix/invalidation-loop
2 parents 9beabae + 1790b48 commit 220534f

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v2
11-
- uses: preactjs/compressed-size-action@v1
11+
- uses: preactjs/compressed-size-action@v2
1212
with:
1313
repo-token: '${{ secrets.GITHUB_TOKEN }}'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*.log
33
node_modules
44
# Dist and query are both build output folders
5-
dist
5+
dist*/
66
!query/
77
# But don't ignore the RTK Query source
88
!src/query/

scripts/build.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ const entryPoints: EntryPointOptions[] = [
116116
]
117117

118118
const esVersionMappings = {
119+
// Don't output ES2015 - have TS convert to ES5 instead
120+
es2015: ts.ScriptTarget.ES5,
119121
es2017: ts.ScriptTarget.ES2017,
120122
es2018: ts.ScriptTarget.ES2018,
121123
es2019: ts.ScriptTarget.ES2019,
@@ -130,7 +132,7 @@ async function bundle(options: BuildOptions & EntryPointOptions) {
130132
folder = '',
131133
prefix = 'redux-toolkit',
132134
name,
133-
target,
135+
target = 'es2015',
134136
entryPoint,
135137
} = options
136138

@@ -142,7 +144,7 @@ async function bundle(options: BuildOptions & EntryPointOptions) {
142144
entryPoints: [entryPoint],
143145
outfile: outputFilePath,
144146
write: false,
145-
target: 'esnext',
147+
target: target,
146148
sourcemap: 'inline',
147149
bundle: true,
148150
format: format === 'umd' ? 'esm' : format,
@@ -232,7 +234,11 @@ async function bundle(options: BuildOptions & EntryPointOptions) {
232234
mapping = transformResult.map as RawSourceMap
233235
}
234236

235-
console.log('Build artifact:', chunk.path)
237+
const relativePath = path.relative(process.cwd(), chunk.path)
238+
console.log(`Build artifact: ${relativePath}, settings: `, {
239+
target,
240+
output: ts.ScriptTarget[esVersion],
241+
})
236242
await fs.writeFile(chunk.path, code)
237243
await fs.writeJSON(chunk.path + '.map', mapping)
238244
}

src/query/core/buildMiddleware.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ export function buildMiddleware<
242242
}
243243

244244
context.batch(() => {
245-
for (const queryCacheKey of toInvalidate.values()) {
245+
const valuesArray = Array.from(toInvalidate.values())
246+
for (const queryCacheKey of valuesArray) {
246247
const querySubState = state.queries[queryCacheKey]
247248
const subscriptionSubState = state.subscriptions[queryCacheKey]
248249
if (querySubState && subscriptionSubState) {

0 commit comments

Comments
 (0)