Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby): temporary workaround for stale jobs cache #33586

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/gatsby/src/redux/reducers/jobsv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export const jobsV2Reducer = (
case `SET_JOB_V2_CONTEXT`: {
const { requestId, job } = action.payload

// A workaround for a stale cache bug:
// in some edge case redux cache is not cleared (even after gatsby-config and package.json changes).
// TODO: figure out the root cause and remove this workaround (see also CLEAR_JOB_V2_CONTEXT)
if (!state.jobsByRequest) {
state.jobsByRequest = new Map()
}
let jobs = state.jobsByRequest.get(requestId)
if (!jobs) {
jobs = new Set<string>()
Expand All @@ -90,6 +96,9 @@ export const jobsV2Reducer = (

case `CLEAR_JOB_V2_CONTEXT`: {
const { requestId } = action.payload
if (!state.jobsByRequest) {
state.jobsByRequest = new Map()
}
state.jobsByRequest.delete(requestId)
}
}
Expand Down