@@ -213,7 +213,8 @@ function orderFilesToBeDeleted(files: Checksum[]): Checksum[] {
213213 ...fileSets . blockLiquidFiles ,
214214 ...fileSets . layoutFiles ,
215215 ...fileSets . otherLiquidFiles ,
216- ...fileSets . configFiles ,
216+ ...fileSets . configDataFile ,
217+ ...fileSets . configSchemaFile ,
217218 ...fileSets . staticAssetFiles ,
218219 ]
219220}
@@ -311,13 +312,23 @@ function selectUploadableFiles(themeFileSystem: ThemeFileSystem, remoteChecksums
311312 * We use this 2d array to batch files of the same type together
312313 * while maintaining the order between file types. The files with
313314 * dependencies we have are:
314- * 1. Layout files don't necessarily need to be the first, but they must uploaded before templates.
315- * 2. Liquid blocks need to be uploaded before sections
316- * 3. Liquid sections need to be uploaded afterwards
317- * 4. JSON sections need to be uploaded after sections
318- * 5. JSON templates need to be uploaded after all sections and layouts
319- * 6. Contextualized templates should be uploaded after as they are variations of templates
320- * 7. Config files must be the last ones, but we need to upload config/settings_schema.json first, followed by config/settings_data.json
315+ *
316+ * 1. config/settings_schema.json must be uploaded FIRST. It declares the
317+ * theme-level settings that block / section / section-group / template
318+ * validators resolve dynamic-source defaults against (e.g. defaults of
319+ * the form `{{ settings.<theme_setting>.<property> }}`).
320+ * 2. Layout files don't necessarily need to be the first, but they must be
321+ * uploaded before templates.
322+ * 3. Liquid blocks need to be uploaded before sections
323+ * 4. Liquid sections need to be uploaded afterwards
324+ * 5. JSON sections need to be uploaded after sections
325+ * 6. JSON templates need to be uploaded after all sections and layouts
326+ * 7. Contextualized templates should be uploaded after as they are
327+ * variations of templates
328+ * 8. config/settings_data.json must be uploaded LAST. Its current and
329+ * presets are validated against the freshly-uploaded
330+ * settings_schema.json, and presets can reference sections and
331+ * templates uploaded in earlier steps.
321332 *
322333 * The files with no dependencies we have are:
323334 * - The other Liquid files (for example, snippets, and liquid templates)
@@ -336,13 +347,14 @@ function orderFilesToBeUploaded(files: ChecksumWithSize[]): {
336347 independentFiles : [ fileSets . otherLiquidFiles , fileSets . otherJsonFiles , fileSets . staticAssetFiles ] ,
337348 // Follow order of dependencies:
338349 dependentFiles : [
350+ fileSets . configSchemaFile ,
339351 fileSets . layoutFiles ,
340352 fileSets . blockLiquidFiles ,
341353 fileSets . sectionLiquidFiles ,
342354 fileSets . sectionJsonFiles ,
343355 fileSets . templateJsonFiles ,
344356 fileSets . contextualizedJsonFiles ,
345- fileSets . configFiles ,
357+ fileSets . configDataFile ,
346358 ] ,
347359 }
348360}
0 commit comments