Skip to content

Commit

Permalink
fr-- -> slice--
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Oct 6, 2022
1 parent 1eb295c commit 32765cf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions packages/gatsby/src/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ export { calcDirtyQueryIds as calcInitialDirtyQueryIds }
*/
export function groupQueryIds(queryIds: Array<string>): IGroupedQueryIds {
const grouped = _.groupBy(queryIds, p => {
const prefix = p.slice(0, 4)
if (prefix === `sq--`) {
if (p.startsWith(`sq--`)) {
return `static`
} else if (prefix === `fr--`) {
} else if (p.startsWith(`slice--`)) {
return `slice`
} else {
return `page`
Expand Down Expand Up @@ -203,7 +202,7 @@ function createSliceQueryJob(
state: IGatsbyState,
queryId: string
): IQueryJob | undefined {
const sliceName = queryId.substring(4)
const sliceName = queryId.substring(7) // remove "slice--" prefix

const sliceDef = state.slices.get(sliceName)
if (!sliceDef) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/query/query-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export async function queryRunner(
store.dispatch({
type: `ADD_PENDING_SLICE_DATA_WRITE`,
payload: {
name: queryJob.id.substring(4),
name: queryJob.id.substring(7), // remove "slice--" prefix
},
})
}
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/src/redux/reducers/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function queriesReducer(
}
case `CREATE_SLICE`: {
const { name, componentPath } = action.payload
const path = `fr--${name}`
const path = `slice--${name}`
let query = state.trackedQueries.get(path)
if (!query || action.contextModified) {
query = registerQuery(state, path)
Expand All @@ -108,7 +108,7 @@ export function queriesReducer(
}
case `DELETE_SLICE`: {
const { name } = action.payload
const path = `fr--${name}`
const path = `slice--${name}`
state.deletedQueries.add(path)
return state
}
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/services/calculate-dirty-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function calculateDirtyQueries({
queriesToRun = queryIds.filter(
queryId =>
queryId.startsWith(`sq--`) ||
queryId.startsWith(`fr--`) ||
queryId.startsWith(`slice--`) ||
pagePathFilter.has(queryId)
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/utils/page-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export async function writeSliceData(
staticQueryHashes: Array<string>
): Promise<string> {
const result = JSON.parse(
(await readPageQueryResult(publicDir, `fr--${name}`)).toString()
(await readPageQueryResult(publicDir, `slice--${name}`)).toString()
)

const outputFilePath = path.join(publicDir, `slice-data`, `${name}.json`)
Expand Down

0 comments on commit 32765cf

Please sign in to comment.